Re: Dave Lyons
Re: Dave Lyons
- Subject: Re: Dave Lyons
- From: Michelle Steiner <email@hidden>
- Date: Mon, 26 Sep 2005 14:12:49 -0700
On Sep 26, 2005, at 1:43 PM, Luther Fuller wrote:
Now let's move forward to just a month ago. I wanted to read/write
plist files using System Events' Property List Suite. The Property
List Suite is very short and, therefore, one would think it would
be easy to use and understand. After trying a few things that
didn't work, I finally decided that the Property List Suite didn't
say anything instructive and I didn't understand it. After more
experiments, I came up with these handlers that do work ...
on readPlistFile(fileAlias)
POSIX path of fileAlias
tell application "System Events"
value of contents of property list file the result
end tell
return the result -- a record
end readPlistFile -------------------------------
on writePlistFile(fileAlias, plistRec)
POSIX path of fileAlias
tell application "System Events"
set (value of contents of property list file the
result) to plistRec
end tell
end writePlistFile -------------------------------
There isn't anything in the Property List Suite dictionary that
tells me that 'value of contents of property list file ...' is what
I should use. I just tried a bunch of stuff until something worked.
This isn't the way a language manual, or dictionary, is supposed to
work!
"contents of" is not necessary; the script works just fine without it
(at least the read script does; I didn't try the set script. Also I
don't understand why "the result" has to be at the end of "value of
property list file the result", but it does.
But the big point is that just from the entries in the dictionary, it
is obvious that "value" will return the values of the items in the
plist.
--
Don't dream it. Be it. --RHPS
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden