Toggle invisible items
Last modification: Saturday, August 22, 2009 12:25 pmToggles the Finder to show or hide invisible items
Implementation
-- Get the current value for the preference settingtry
set _bitSet to do shell script "defaults read com.apple.Finder AppleShowAllFiles"
set _bitSet to _bitSet as integer
set _bitSet to _bitSet as boolean
on error
set _bitSet to false
end try
-- Quit the target application, allowing recent changes by the user to be saved
tell application "Finder" to quit
repeat 100 times
tell application "System Events" to if (exists process "Finder") is false then exit repeat
delay 0.1
end repeat
if _bitSet then
do shell script "defaults write com.apple.Finder AppleShowAllFiles -boolean NO"
else
do shell script "defaults write com.apple.Finder AppleShowAllFiles -boolean YES"
end if
-- Launch the Finder
tell application "Finder" to launch