-- Michael J. Waddell -- http://www.mwaddell.com -- Code adapted from http://www.macosxhints.com/article.php?story=20030409015020645 set OnOff to do shell script "defaults read com.apple.finder AppleShowAllFiles" if OnOff = "NO" or OnOff = "OFF" then set buttonPressed to "Visible" else set buttonPressed to "Invisible" end if 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