Re: getting a list of labels from a record?
Re: getting a list of labels from a record?
- Subject: Re: getting a list of labels from a record?
- From: Emmanuel LEVY <email@hidden>
- Date: Mon, 03 Jun 2013 12:28:56 +0200
Sorry, not sure I replied in time.
PlistOpen accepts, either a path (under any form), or a string of XML data, that is some string starting with "<".
Best,
Emmanuel
On May 28, 2013, at 11:53 PM, Christopher Stone wrote:
> On May 28, 2013, at 08:36, Emmanuel LEVY <email@hidden> wrote:
>> I'm sure using an osax wouldn't be an option, but if it were, you would get the list of the keys with one line:
>>
>> plistgetkeys (plistnew theRecord)
> ______________________________________________________________________
>
> Hallo Emmanuel,
>
> I don't mind using an osax. :)
>
> This is helpful.
>
> I don't think the syntax is very discoverable, so every working example helps.
>
> PlistOpen has a string parameter. Is it able to take a string of xml data? If so what would be the syntax?
>
> Thanks.
>
> --
> Take Care,
> Chris
>
> -------------------------------------------------------------------------------------------
> # Alias to binary Plist File
> -------------------------------------------------------------------------------------------
>
> set plistAlias to alias ((path to downloads folder as text) & "cc.omh.Clyppan.plist")
>
> -------------------------------------------------------------------------------------------
> # Getting keys from a plist file directly:
> -------------------------------------------------------------------------------------------
>
> set _plist to PlistOpen plistAlias
> set _keys to PlistGetKeys (PlistNew _plist)
> PlistClose _plist
> _keys
>
> -------------------------------------------------------------------------------------------
> # Getting keys from a simple record:
> -------------------------------------------------------------------------------------------
>
> set _record to {key1:"Value1", key2:"Value2"}
> set _keys to PlistGetKeys (PlistNew _record)
>
> -------------------------------------------------------------------------------------------
> # Getting keys from a record (creating a record for the example using 'plutil' and
> # System Events) - just to test a more complex record.
> -------------------------------------------------------------------------------------------
>
> set _plist to do shell script "plutil -convert xml1 -o - " & quoted form of POSIX path of plistAlias
> tell application "System Events"
> set _record to value of (make property list item with properties {text:_plist})
> end tell
> set _keys to PlistGetKeys (PlistNew _record)
>
> -------------------------------------------------------------------------------------------
>
> _______________________________________________
> 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/archives/applescript-users
>
> This email sent to email@hidden
_______________________________________________
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/archives/applescript-users
This email sent to email@hidden