panlilu
2012-03-06 21:32:30 +08:00
try
do shell script "defaults read com.apple.finder AppleShowAllFiles"
on error
get 0
end try
set i to (result + 1) mod 2 -- Get opposite of current value
tell application "Finder"
activate
get item (i + 1) of {"Hide", "Show"}
display dialog (result & " all hidden files in Finder?") buttons {"Cancel", (result & " Hidden Files")} default button 2 with icon note
quit
end tell
delay 0.5
try
do shell script "defaults write com.apple.Finder AppleShowAllFiles " & i
launch application "Finder"
on error errorMsg number errorNum
display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "Cancel" default button 1 with icon caution
end try
----
上面的apple script运行一下就好了