I named the script below ToggleShowHiddenFiles.scpt. When I run the script I get this error:
./ToggleShowHiddenFiles.scpt
./ToggleShowHiddenFiles.scpt:134:140: script error: Expected “then”, etc. but found identifier. (-2741)
The syntax appears correct, can anyone tell me how to avoid this error?
#!/usr/bin/osascript
tell current application
set HiddenStatus to do shell script "defaults read com.apple.finder AppleShowAllFiles"
if Hidden Status = "NO" then
do shell script "defaults write com.apple.finder AppleShowAllFiles YES && killall Finder"
else
do shell script "defaults write com.apple.finder AppleShowAllFiles NO && killall Finder"
end if
end tell
./ToggleShowHiddenFiles.scpt
./ToggleShowHiddenFiles.scpt:134:140: script error: Expected “then”, etc. but found identifier. (-2741)
The syntax appears correct, can anyone tell me how to avoid this error?
#!/usr/bin/osascript
tell current application
set HiddenStatus to do shell script "defaults read com.apple.finder AppleShowAllFiles"
if Hidden Status = "NO" then
do shell script "defaults write com.apple.finder AppleShowAllFiles YES && killall Finder"
else
do shell script "defaults write com.apple.finder AppleShowAllFiles NO && killall Finder"
end if
end tell