Re: Reading data from plist file
Re: Reading data from plist file
- Subject: Re: Reading data from plist file
- From: Jim Weisbin <email@hidden>
- Date: Sun, 21 Feb 2016 15:14:22 -0500
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:
oh damn, I sent this to the wrong list. Meant to send to the applescript list.
I have not got much experience with ASObjC. This works if I hard code the file name in place of "/Users/shane/Desktop/Sample.plist”. But how do I prompt for the file name instead?
When I try to add a “choose file… etc, it fails to compile.
Thanks.
Jim Weisbin | C.T.O. | human | 138 Fifth Avenue | 3rd Floor | New York, NY | 10011 | |
_______________________________________________
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