I just installed Lion on an unused partition and tested the parts of my script. Very revealing!
Here is a handler with notes ...
on showInvisibles() tell application "Finder" (path to preferences folder from user domain) as text set filePath to the result & "com.apple.finder.plist" quit end tell 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 -- this line fails because the "AppleShowAllFiles" key is not present in a new prefs file. on error -- causing this to run. try (value of property list file filePath) & {|AppleShowAllFiles|:true} set value of property list file filePath to the result -- this successfully adds 'AppleShowAllFiles' to -- the preference file "com.apple.finder.plist" -- and Finder immediately becomes inoperative. end try end try
end tell tell application "Finder" to activate beep end showInvisibles -----------------------------
When I replaced com.apple.finder.plist with a known good copy from another Lion installation, the problem disappeared.
I have not tried using 'do shell script "defaults ..." ' (yet), but if anyone does, let us know.
In order to see these changes in com.apple.finder.plist, I had to startup in Snow Leopard in order to use Property List Editor 5.3, which will not even launch in Lion. When I design a preferences file for an AppleScripted application, PLE is absolutely necessary in order to see what I am doing.
The absence of PLE in Lion seems odd and may be ominous.
Also, what is "com.apple.finder.plist.lockfile" ? This is something new in Lion and may have something to do with this problem.
|