<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Toggling File Visibility in the Finder via AppleScript</title>
	<atom:link href="http://theapotek.com/teknotes/2003/04/10/toggling-file-visibility-in-the-finder-via-applescript/feed/" rel="self" type="application/rss+xml" />
	<link>http://theapotek.com/teknotes/2003/04/10/toggling-file-visibility-in-the-finder-via-applescript/</link>
	<description>Web consulting and programming in PHP, MySQL, JavaScript, HTML, CSS, networking and logistics consulting.</description>
	<lastBuildDate>Thu, 14 Jan 2010 20:32:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: kristofer</title>
		<link>http://theapotek.com/teknotes/2003/04/10/toggling-file-visibility-in-the-finder-via-applescript/comment-page-1/#comment-13044</link>
		<dc:creator>kristofer</dc:creator>
		<pubDate>Mon, 22 Sep 2008 17:16:05 +0000</pubDate>
		<guid isPermaLink="false">http://theapotek.com/teknotes/?p=9#comment-13044</guid>
		<description>Thanks for the suggestions and improvements, guys! Great stuff. 

[Update: There is &lt;a href=&quot;http://macscripter.net/viewtopic.php?id=16527&quot; title=&quot;Macscripter: Toggle Hidden Files&quot; rel=&quot;nofollow&quot;&gt;a good thread on this topic&lt;/a&gt; at macscripter.net.]</description>
		<content:encoded><![CDATA[<p>Thanks for the suggestions and improvements, guys! Great stuff. </p>
<p>[Update: There is <a href="http://macscripter.net/viewtopic.php?id=16527" title="Macscripter: Toggle Hidden Files" rel="nofollow">a good thread on this topic</a> at macscripter.net.]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://theapotek.com/teknotes/2003/04/10/toggling-file-visibility-in-the-finder-via-applescript/comment-page-1/#comment-13043</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Sun, 21 Sep 2008 21:16:33 +0000</pubDate>
		<guid isPermaLink="false">http://theapotek.com/teknotes/?p=9#comment-13043</guid>
		<description>The the script posted by kristofer produces errors when run in OS X v10.5; the most serious of these is that the shell script as written doesn&#039;t seem to accept the options of 0 or 1, but rather only seems to work when the string &quot;ON&quot; is used.

Thus, if one wishes, the prettier dialogs of his script as well as the error checking can be rather easily incorporated into the original, which runs very quickly on my MB-Pro:

----

set onOff to do shell script &quot;defaults read com.apple.finder AppleShowAllFiles&quot;
if onOff = &quot;NO&quot; or onOff = &quot;OFF&quot; or onOff = &quot;0&quot; then
	set newState to &quot;SHOW&quot;
	set OnOffCommand to &quot;defaults write com.apple.finder AppleShowAllFiles ON&quot;
else
	set newState to &quot;HIDE&quot;
	set OnOffCommand to &quot;defaults write com.apple.finder AppleShowAllFiles OFF&quot;
end if

display dialog &quot;Do you want to &quot; &amp; newState &amp; &quot; invisible files? (This will restart the Finder.)&quot; buttons {&quot;Cancel&quot;, (newState &amp; &quot; Invisible Files&quot;)} default button 2 with icon note
copy the result as list to {buttonPressed}

if the buttonPressed is not &quot;Cancel&quot; then
	try
		tell application &quot;Finder&quot; to quit
		do shell script OnOffCommand
		delay 1
		tell application &quot;Finder&quot; to launch
	on error errorMsg number errorNum
		display dialog &quot;Error (&quot; &amp; errorNum &amp; &quot;):&quot; &amp; return &amp; return &amp; errorMsg buttons &quot;Cancel&quot; default button 1 with icon caution
	end try
end if</description>
		<content:encoded><![CDATA[<p>The the script posted by kristofer produces errors when run in OS X v10.5; the most serious of these is that the shell script as written doesn&#8217;t seem to accept the options of 0 or 1, but rather only seems to work when the string &#8220;ON&#8221; is used.</p>
<p>Thus, if one wishes, the prettier dialogs of his script as well as the error checking can be rather easily incorporated into the original, which runs very quickly on my MB-Pro:</p>
<p>&#8212;-</p>
<p>set onOff to do shell script &#8220;defaults read com.apple.finder AppleShowAllFiles&#8221;<br />
if onOff = &#8220;NO&#8221; or onOff = &#8220;OFF&#8221; or onOff = &#8220;0&#8243; then<br />
	set newState to &#8220;SHOW&#8221;<br />
	set OnOffCommand to &#8220;defaults write com.apple.finder AppleShowAllFiles ON&#8221;<br />
else<br />
	set newState to &#8220;HIDE&#8221;<br />
	set OnOffCommand to &#8220;defaults write com.apple.finder AppleShowAllFiles OFF&#8221;<br />
end if</p>
<p>display dialog &#8220;Do you want to &#8221; &amp; newState &amp; &#8221; invisible files? (This will restart the Finder.)&#8221; buttons {&#8220;Cancel&#8221;, (newState &amp; &#8221; Invisible Files&#8221;)} default button 2 with icon note<br />
copy the result as list to {buttonPressed}</p>
<p>if the buttonPressed is not &#8220;Cancel&#8221; then<br />
	try<br />
		tell application &#8220;Finder&#8221; to quit<br />
		do shell script OnOffCommand<br />
		delay 1<br />
		tell application &#8220;Finder&#8221; to launch<br />
	on error errorMsg number errorNum<br />
		display dialog &#8220;Error (&#8221; &amp; errorNum &amp; &#8220;):&#8221; &amp; return &amp; return &amp; errorMsg buttons &#8220;Cancel&#8221; default button 1 with icon caution<br />
	end try<br />
end if</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kristofer</title>
		<link>http://theapotek.com/teknotes/2003/04/10/toggling-file-visibility-in-the-finder-via-applescript/comment-page-1/#comment-27</link>
		<dc:creator>kristofer</dc:creator>
		<pubDate>Tue, 24 Apr 2007 21:44:14 +0000</pubDate>
		<guid isPermaLink="false">http://theapotek.com/teknotes/?p=9#comment-27</guid>
		<description>A better version of the script.
&lt;code&gt;
--Bruce Philips
--macscripter.net


try
	do shell script &quot;/usr/bin/defaults read com.apple.Finder AppleShowAllFiles&quot;
	get result as integer
on error
	get 0
end try

set i to (result + 1) mod 2 -- Get opposite of current value

tell application &quot;Finder&quot;
	activate
	get item (i + 1) of {&quot;Hide&quot;, &quot;Show&quot;}
	display dialog (result &amp; &quot; all hidden files in Finder?&quot;) buttons {&quot;Cancel&quot;, (result &amp; &quot; Hidden Files&quot;)} default button 2 with icon note
	quit
end tell

try
	do shell script &quot;/usr/bin/defaults write com.apple.Finder AppleShowAllFiles &quot; &amp; i
	launch application &quot;Finder&quot;
on error errorMsg number errorNum
	display dialog &quot;Error (&quot; &amp; errorNum &amp; &quot;):&quot; &amp; return &amp; return &amp; errorMsg buttons &quot;Cancel&quot; default button 1 with icon caution
end try
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>A better version of the script.<br />
<code><br />
--Bruce Philips<br />
--macscripter.net</p>
<p>try<br />
	do shell script "/usr/bin/defaults read com.apple.Finder AppleShowAllFiles"<br />
	get result as integer<br />
on error<br />
	get 0<br />
end try</p>
<p>set i to (result + 1) mod 2 -- Get opposite of current value</p>
<p>tell application "Finder"<br />
	activate<br />
	get item (i + 1) of {"Hide", "Show"}<br />
	display dialog (result &#038; " all hidden files in Finder?") buttons {"Cancel", (result &#038; " Hidden Files")} default button 2 with icon note<br />
	quit<br />
end tell</p>
<p>try<br />
	do shell script "/usr/bin/defaults write com.apple.Finder AppleShowAllFiles " &#038; i<br />
	launch application "Finder"<br />
on error errorMsg number errorNum<br />
	display dialog "Error (" &#038; errorNum &#038; "):" &#038; return &#038; return &#038; errorMsg buttons "Cancel" default button 1 with icon caution<br />
end try<br />
</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>

