On Apr 9, 2014, at 9:13 AM, 2551 wrote: Way back when Matt Neuburg wrote AppleScript: The Definitive Guide, he stated that: “There is no built-in way to obtain a list of the names of the items of a record.
I suspect that the question could be restated as: "Is there any way to see the structure of a record for development purposes ?"
The handler that I posted in my last response will probably fail if given a complicated record structure. Here is something that will always work and that I always use. Put this handler in your script during development.
on writeRecordToPlist(aRecord) set newFilePath to ((path to desktop) as text) & "record-display" tell application "System Events" make new property list item with properties {kind:record, value:aRecord} make new property list file with properties {contents:the result, name:newFilePath} end tell end writeRecordToPlist ----------------
When you encounter a record whose structure you need, insert
my writeRecordToPlist(someRecord)
at the proper place; run your script; then, immediately comment out or remove the call to the handler. (You only need it once!)
The file "record-display" will appear on your desktop. Double-click it and it will open in Xcode. Everything you need to know about the record is now visible. !!!!
|