On Mar 31, 2010, at 6:05 PM, Shane Stanley wrote: On 1/4/10 9:40 AM, "Luther Fuller" < email@hidden> wrote: Do you have a line of code that's known to work?
This gives no error, but the resulting file is empty: set deskAlias to path to desktop tell application "System Events" to make new property list file at end of files of deskAlias with properties {name:"Testing.plist"} Perhaps providing other properties or data might give something useful, but after a bit of a play, I'm not confident.
I did a little experimenting with this ...
property defaultPrefsRec : {a:1, b:"str", c:true, d:{1, 2, 3}} set deskAlias to path to desktop -- tell application "System Events" to make new property list file at end of files of deskAlias with properties {name:"Testing.plist"} tell application "Finder" to set prefsFile to (file "Testing.plist" of deskAlias) as alias tell application "System Events" to set value of property list file (prefsFile as text) to defaultPrefsRec -- <<<<<<< WRITE
The file created in the line now commented out seems to be broken.
A preference .plist file I created with the code I posted earlier, when opened with TextEdit, shows a header
bplist00รท
followed with data that I can recognize. The "Testing.plist" file shows simply
{ "New item" = "THIS IS A TEST.."; }
which is data I entered manually via PLE. The code above fails at the last line and the content of the "Testing.plist" file is erased.
I'm now confused, but suspect that System Events does not know what a property list file is.
|