Re: Empty Record
Re: Empty Record
- Subject: Re: Empty Record
- From: Nigel Garvey <email@hidden>
- Date: Tue, 12 Apr 2011 22:15:11 +0100
Luther Fuller wrote on Tue, 12 Apr 2011 13:39:33 -0500:
>On Apr 12, 2011, at 10:25 AM, Axel Luttgens wrote:
>> Maybe this one:
>>
>> tell application "System Events"
>> set PLI to make new property list item with properties {kind:record}
>> end tell
>>
>> could be of some help wrt .plist files?
>
>Thanks. Tried variations on this theme, but could not get what I wanted.
>The .plist already contains the 'root' dictionary which contains one item,
>a dictionary named "xxx".
>I need to add the empty dictionary to the root dictionary so that it now
>contains two items "xxx" and "yyy", both dictionaries with "yyy" being
>empty.
So the root item is itself a record with an existing xxx property and
you want to add a yyy property whose value is an empty record? Using the
System Events approach, it seems best to leave the value undefined, or
perhaps set it to 'missing value'. Giving it a {} value seems to reset
it to a list.
tell application "System Events"
-- Say this is the existing container record which already has an
"xxx" property.
set pli to make new property list item with properties {value:{xxx:{}}}
-- Make a "yyy" property of kind record with no value for now.
set yyy to (make new property list item at end of property list
items of pli with properties {name:"yyy", kind:record})
-- To test it, try giving it a property 'a' with a string value.
make new property list item at end of property list items of yyy
with properties {name:"a", kind:string, value:"aardvark"}
value of pli --> {xxx:{}, yyy:{a:"aardvark"}}
end tell
I haven't tried this though with the contents of an existing plist file.
NG
_______________________________________________
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