Created
June 26, 2012 20:04
-
-
Save jpoehls/2998520 to your computer and use it in GitHub Desktop.
Toggle hidden files in Finder. (AppleScript)
Thanks for the super handy script. You can make an app for it using Automator so it runs without opening Script Editor.
A small tweak: using "kill all finder" keeps your current finder windows open.
set state to 0
try
set state to do shell script "defaults read com.apple.finder AppleShowAllFiles" as string
end try
if state is "1" then
do shell script "defaults write com.apple.finder AppleShowAllFiles -bool FALSE"
else
do shell script "defaults write com.apple.finder AppleShowAllFiles -bool TRUE"
end if
do shell script "killall Finder"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This does not work first time, when the prefs file does not exist, or when prefs exist, but the setting does not. Try this:
set state to 0
try
set state to do shell script "defaults read com.apple.finder AppleShowAllFiles" as string
end try
if state is "1" then
do shell script "defaults write com.apple.finder AppleShowAllFiles -bool FALSE"
else
do shell script "defaults write com.apple.finder AppleShowAllFiles -bool TRUE"
end if
tell application "Finder" to quit
delay 1
tell application "Finder" to launch