• 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: Reading data from plist file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading data from plist file


  • Subject: Re: Reading data from plist file
  • From: Shane Stanley <email@hidden>
  • Date: Sun, 21 Feb 2016 11:57:39 +1100

On 21 Feb 2016, at 12:00 AM, Jim Weisbin <email@hidden> wrote:

Any advice on how to recurse through the sublists (there could be multiple levels) would be appreciated.

You could do it like this:

use framework "Foundation"

-- classes and constants used
property NSMutableArray : a reference to current application's NSMutableArray
property NSDictionary : a reference to current application's NSDictionary

set theDict to (NSDictionary's dictionaryWithContentsOfFile:"/Users/shane/Desktop/Sample.plist")
set theArray to NSMutableArray's array()
my addFileIDSIn:theDict toList:theArray
set theResult to theArray as list

on addFileIDSIn:aDict toList:theArray
set theIDs to aDict's valueForKey:"fileIDs"
theArray's addObjectsFromArray:theIDs
set theSublists to aDict's valueForKey:"sublists"
if theSublists is not missing value then
repeat with aSublist in theSublists
(my addFileIDSIn:aSublist toList:theArray)
end repeat
end if
end addFileIDSIn:toList:

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Reading data from plist file (From: Jim Weisbin <email@hidden>)

  • Prev by Date: Reading data from plist file
  • Next by Date: Re: Reading data from plist file
  • Previous by thread: Reading data from plist file
  • Next by thread: Re: Reading data from plist file
  • Index(es):
    • Date
    • Thread