Re: Getting started with XML?
Re: Getting started with XML?
- Subject: Re: Getting started with XML?
- From: Luther Fuller <email@hidden>
- Date: Wed, 7 Feb 2007 18:24:27 -0600
The only reliably safe method of reading a .plist file is to read the
whole file into a record, like this ...
-- plistAlias is an alias to a plist file
tell application "System Events"
plistAlias as text
set plistRec to (value of property list file the result)
end tell
(Dictionaries in the plist file become sub-records within plistRec,
arrays become lists, other kinds are obvious.)
If there are missing items in the plistRec, do this ...
property defaultRec : {Total Time:__, Year:__, Library Folder
Count:__, Bit Rate"__, ....}
(You have to fill-in the blanks with default values that make sense.
Usually these will be 0, "" or {}.) Then ...
set plistRec to (plistRec & defaultRec)
plistRec now contains all the values that were in the original plist
file, together with the missing values from the defaultRec. Only the
missing values are replaced by defaults. That's the way concatenation
works with records.
What, you may ask is the structure of plistRec? The only way to know
this is to install "Property List Editor.app" from Developer Tools,
then use it to open and inspect the plist file. (Don't even think of
"Dump"ing the file! It only adds confusion.)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden