-
-
Save jpoehls/2998520 to your computer and use it in GitHub Desktop.
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
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"
Thanks for sharing!