tell application "Finder"
(path to preferences folder from user domain) as text
set filePath to the result & "com.apple.finder.plist"
quit
end tell
-- delay 1
tell application "System Events"
repeat -- until not (exists application process "Finder")
delay 0.1
if not (exists application process "Finder") then exit repeat
end repeat
try
set value of property list item "AppleShowAllFiles" of property list file filePath to (true)
on error
try
(value of property list file filePath) & {|AppleShowAllFiles|:true}
set value of property list file filePath to the result
end try
end try
end tell
tell application "Finder" to activate
end showInvisibles -----------------------------
Now for the bad news … It FAILS IN MT. LION.
There is no error message, it just does not do anything.