Iterating over items in a record, possible?
Iterating over items in a record, possible?
- Subject: Iterating over items in a record, possible?
- From: Ken Tozier <email@hidden>
- Date: Fri, 9 Jan 2009 05:08:28 -0500
Hi
I'm writing a general purpose script to convert a complex nested
record into an Apple "plist" and can't figure out how to iterate over
items in a record if I don't know any of the record keys beforehand.
For example, given the following record, I'd like to iterate the items
and get the keywords and the values something like the following
pseudo-code
set aRecord to {height: 100, width: 100, originX: 10, originY: 10}
set xml to "<dict>" & return
repeat with anItem in aRecord
set itemKey to keyword of anItem
set itemValue to value of anItem
set xml to xml & tab & "<key>" & itemKey & "</key>" & return
set xml to xml & tab & "<string>" & itemValue & "</string >" & return
end
set xml to xml & "</dict>"
Keep in mind, I have no control over the keywords and I actually don't
know what they are. They are whatever the target application returns
for a query.
Thanks for any help
_______________________________________________
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