Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'An AppleScript to quickly show or hide hidden files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
An AppleScript to quickly show or hide hidden files
Authored by: zweigand on Apr 10, '03 12:03:12PM
please disregard my last post!! ...that script does not work! (feel rather stupid ;) ...here is a better one..that DOES work (for me anyway!) ...i had to throw a delay in because apparently the script was done before the finder fully quit... and this wouldn't allow the finder to restart!
display dialog "Set the visibility of hidden files..." buttons {"Cancel", "Visible", "Invisible"} default button 1
copy the result as list to {buttonpressed}
if the buttonpressed is "Invisible" then
      try
		tell application "Finder" to quit
		do shell script "defaults write com.apple.finder AppleShowAllFiles OFF"
		delay 1
		tell application "Finder" to activate
	end try
else if the buttonpressed is "Visible" then
	try
		tell application "Finder" to quit
		do shell script "defaults write com.apple.finder AppleShowAllFiles ON"
		delay 1
		tell application "Finder" to activate
	end try
end if


[ Reply to This | # ]
An AppleScript to quickly show or hide hidden files
Authored by: frogstomp on Apr 10, '03 02:13:49PM

This is strange for me. I can not seem to get this script to re-
launch the Finder after selecting 'invisible' or 'visable'.

The script seems to hang at 'delay 1'

It works for you, I am curious to understand why not for
myself?

Just as a note from my experience working out this script, the
reason I have `tell application "Finder" to quit ' at the
beginning of the script is, if I had that line anywhere else in my
script, I was unable to relaunch the finder. Also to note, that
whenever I was unable to Script Launch the finder, the defaults
attribute would not change... Strange hey.

Thanks for the reply and suggestions, I am learning a lot by
other peoples code.

cheers!



[ Reply to This | # ]
It works for me now...
Authored by: frogstomp on Apr 10, '03 02:32:29PM

Just wanted to note that your script does work for me now.

For whatever reason Any of the 'Working' scripts which quit the
finder and relaunch them tend to be a little buggy.

Sometimes these scripts when run from the ScriptEditor will
hang at the "tell application "Finder" to quit" line.

Other times the Finder will not relaunch.

Once the script is in a working state though, it seems to work
99% of the time...

Just a strange observation with my finder,

Thank you again, I do appreciate the help learning.



[ Reply to This | # ]
It works for me now...
Authored by: zweigand on Apr 10, '03 03:58:51PM

glad it works now... i had never used a script to quit the finder like that... i had to tweak it so that (as you said) the finder would relaunch ....it was a learning experince for me as well ;)



[ Reply to This | # ]
An AppleScript to quickly show or hide hidden files
Authored by: OmniDragon on Apr 04, '10 12:09:12PM

"please disregard my last post!! ...that script does not work! (feel rather stupid ;)"

Shouldn't feel too bad. The original poster's script didn't work either. He called out a button variable that he didn't define resulting in:

"Specified button does not exist."

Had to change "default button 3" to "default button 2" because there IS no button 3



[ Reply to This | # ]