I have the following Applescript which toggles the show/hide hidden files and I would like to reopen the user's Finder windows which will be closed as the Finder gets relaunched.
tell application "Finder" to quit
set OnOff to do shell script "defaults read com.apple.finder AppleShowAllFiles"
if OnOff = "NO" or OnOff = "OFF" then
set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles ON"
else
set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles OFF"
end if
do shell script OnOffCommand
delay 1
tell application "Finder" to launch
tell application "Finder"
try
target of window 1
make new Finder window to result
on error
make new Finder window to home
end try
end tell
Can anyone point me in the right direction?