• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: getting a list of labels from a record?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting a list of labels from a record?


  • Subject: Re: getting a list of labels from a record?
  • From: Christopher Stone <email@hidden>
  • Date: Tue, 28 May 2013 16:53:57 -0500

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

References: 
 >getting a list of labels from a record? (From: Alex Hall <email@hidden>)
 >Re: getting a list of labels from a record? (From: Emmanuel LEVY <email@hidden>)

  • Prev by Date: Re: getting a list of labels from a record?
  • Next by Date: Re: getting a list of labels from a record?
  • Previous by thread: Re: getting a list of labels from a record?
  • Next by thread: Word 2008 script broken in Word 2011
  • Index(es):
    • Date
    • Thread