|
Here is a simple applescript that toggles show hidden files in Finder. Someone in the comments stated that it doesn't work unless the key "ShowAllFiles" in your Finder plist is there, which by default, its not there. I revised the script to account for that.
try
set myvar to do shell script "defaults read com.apple.finder AppleShowAllFiles"
if myvar is "FALSE" then
do shell script "defaults write com.apple.finder AppleShowAllFiles TRUE"
do shell script "killall Finder"
else if myvar is equal to "TRUE" then
do shell script "defaults write com.apple.finder AppleShowAllFiles FALSE"
do shell script "killall Finder"
else
display dialog "Error"
end if
on error
display dialog "Would you like to hide files or show files?" buttons {"Show", "Hide"} default button "Hide"
set myChoice to button returned of result
if myChoice is "Show" then
do shell script "defaults write com.apple.finder AppleShowAllFiles TRUE"
do shell script "killall Finder"
else if myChoice is "Hide" then
do shell script "defaults write com.apple.finder AppleShowAllFiles FALSE"
do shell script "killall Finder"
else
display dialog "Error"
end if
end try
|