An AppleScript to quickly show or hide hidden files

Apr 10, '03 09:37:00AM

Contributed by: frogstomp

I enjoy using GUI Finder, but find I need to access the hidden files sometimes. So I created a quick AppleScript (using its ability to call shell scripts) to efficiently switch between hidden files off and on. Here it is:

tell application "Finder" to quit
display dialog "Show Hidden Files..." buttons {"ON", "OFF"} ¬
  default button 3
copy the result as list to {buttonpressed}

try
  if the buttonpressed is "OFF" then do shell script ¬
    "defaults write com.apple.finder AppleShowAllFiles OFF"
  if the buttonpressed is "ON" then do shell script ¬
    "defaults write com.apple.finder AppleShowAllFiles ON"
end try

tell application "Finder" to launch
This is my first AppleScript so I am very open to any improvements to it. Perhaps this will be of some assisstance to people like myself. I found it handy to place this script in the Script Menu, and hotkeyed this script also.

[robg adds: I tested this script and it works as expected.]


Panther proven!

Comments (56)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030409015020645