<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Toggling File Visibility in the Finder via AppleScript</title>
	<link>http://theapotek.com/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>
	<pubDate>Sat, 11 Oct 2008 02:37:34 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: kristofer</title>
		<link>http://theapotek.com/2003/04/10/toggling-file-visibility-in-the-finder-via-applescript/#comment-13044</link>
		<dc:creator>kristofer</dc:creator>
		<pubDate>Mon, 22 Sep 2008 16:16:05 +0000</pubDate>
		<guid>http://theapotek.com/2003/04/10/toggling-file-visibility-in-the-finder-via-applescript/#comment-13044</guid>
		<description>Thanks for the suggestions and improvements, guys! Great stuff.</description>
		<content:encoded><![CDATA[<p>Thanks for the suggestions and improvements, guys! Great stuff.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://theapotek.com/2003/04/10/toggling-file-visibility-in-the-finder-via-applescript/#comment-13043</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Sun, 21 Sep 2008 21:16:33 +0000</pubDate>
		<guid>http://theapotek.com/2003/04/10/toggling-file-visibility-in-the-finder-via-applescript/#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't seem to accept the options of 0 or 1, but rather only seems to work when the string "ON" 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 "defaults read com.apple.finder AppleShowAllFiles"
if onOff = "NO" or onOff = "OFF" or onOff = "0" then
	set newState to "SHOW"
	set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles ON"
else
	set newState to "HIDE"
	set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles OFF"
end if

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

if the buttonPressed is not "Cancel" then
	try
		tell application "Finder" to quit
		do shell script OnOffCommand
		delay 1
		tell application "Finder" to launch
	on error errorMsg number errorNum
		display dialog "Error (" &#38; errorNum &#38; "):" &#38; return &#38; return &#38; errorMsg buttons "Cancel" 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 {&#8221;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/2003/04/10/toggling-file-visibility-in-the-finder-via-applescript/#comment-27</link>
		<dc:creator>kristofer</dc:creator>
		<pubDate>Tue, 24 Apr 2007 20:44:14 +0000</pubDate>
		<guid>http://theapotek.com/2003/04/10/toggling-file-visibility-in-the-finder-via-applescript/#comment-27</guid>
		<description>A better version of the script.
&lt;code&gt;
--Bruce Philips
--macscripter.net


try
	do shell script "/usr/bin/defaults read com.apple.Finder AppleShowAllFiles"
	get result as integer
on error
	get 0
end try

set i to (result   1) mod 2 -- Get opposite of current value

tell application "Finder"
	activate
	get item (i   1) of {"Hide", "Show"}
	display dialog (result &#038; " all hidden files in Finder?") buttons {"Cancel", (result &#038; " Hidden Files")} default button 2 with icon note
	quit
end tell

try
	do shell script "/usr/bin/defaults write com.apple.Finder AppleShowAllFiles " &#038; i
	launch application "Finder"
on error errorMsg number errorNum
	display dialog "Error (" &#038; errorNum &#038; "):" &#038; return &#038; return &#038; errorMsg buttons "Cancel" 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>
