Re: get properties treating variable as literal
Re: get properties treating variable as literal
- Subject: Re: get properties treating variable as literal
- From: "Gary (Lists)" <email@hidden>
- Date: Thu, 05 Oct 2006 09:33:41 -0400
"Christopher Nebel" wrote:
> On Oct 4, 2006, at 4:51 PM, Emmanuel wrote:
>
>> At 4:17 PM -0700 10/4/06, Christopher Nebel wrote:
>>
>>> For example, if you wanted to get all of the keys as strings, you
>>> could say something like this:
>>>
>>> tell application "System Events"
>>> set f to file "com.apple.dashboard.plist" of the preferences folder
>>> set p to property list file (path of f)
>>> get name of every property list item of p
>>> end tell
>>> --> {"other-gadgets", "locale", "tilde-mod", "widget-list", "layer-
>>> gadgets", "slash-mod"}
>>>
>>> Now that you have a list of strings, you can ask for individual
>>> values by their key name, such as...
>>>
>>> value of property list item "locale" of p
>>> --> "en_US"
>>
>> Slightly off-topic since it uses a third-party addition, here how it
>> would go with XMLLib.osax...
>
> Except for when it completely fails because a .plist file isn't necessarily
> XML.
The name of the OSAX (XMLLib) is a bit of a misnomer, really. The extension
contains 2 major suites: XML Suite and Plist Suite. I have not had any
.plist-related problems using this extension.
Still, I do not know enough to know whether this means that Chris'
cautionary prediction might come true. I will let Emmanuel address that, if
he'd like (I hope he does, as it's important.)
In general, the XMLLib (+ Plist) OSAX is a robust and more direct solution
to parsing those two kinds of files than other tools that I've tried.
--
Gary
_______________________________________________
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