• 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: names of a record's items
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: names of a record's items


  • Subject: Re: names of a record's items
  • From: Luther Fuller <email@hidden>
  • Date: Wed, 09 Apr 2014 14:03:43 -0500

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. !!!!



 _______________________________________________
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

  • Follow-Ups:
    • Re: names of a record's items
      • From: Alex Zavatone <email@hidden>
    • Re: names of a record's items
      • From: Alex Zavatone <email@hidden>
  • Prev by Date: Re: names of a record's items
  • Next by Date: Re: names of a record's items
  • Previous by thread: Re: names of a record's items
  • Next by thread: Re: names of a record's items
  • Index(es):
    • Date
    • Thread