• 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: Picking data from a record
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Picking data from a record


  • Subject: Re: Picking data from a record
  • From: Emmanuel <email@hidden>
  • Date: Fri, 24 Sep 2004 17:12:49 +0200

At 9:46 AM -0400 24/09/04, John Fountain wrote:
set testRecord to {H:"Height", W:"Width"}
set sampleData1 to {1, "H", 2}
set testThis to item 2 of sampleData1
set finalResult to (item testThis) in testRecord

Ideally you would write:

set testRecord to {h:"Height", w:"Width"}
set sampleData1 to {1, "H", 2}
set testThis to item 2 of sampleData1
set finalResult to run script (testThis & " of " & (display testRecord))
 -- "Height"

The problem is that this uses the "display" command to make your record into a string, and you can use "display" only in Smile. If you can work with Smile (the AppleScript environment which is free and cool), then you're all set. Otherwise, you've got to find a way to make the record into a string.

Or, you can use a p-list:

set testRecord to {h:"Height", w:"Width"}
set theplist to PlistNew testRecord
set sampleData1 to {1, "h", 2}
set testThis to item 2 of sampleData1
set finalResult to PlistGet (PlistChild theplist key testThis)
 -- "Height"

But still this requires that you use Smile!

Emmanuel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Picking data from a record (From: John Fountain <email@hidden>)

  • Prev by Date: Re: Get HFS Path of POSIX Path?
  • Next by Date: Re: Get HFS Path of POSIX Path?
  • Previous by thread: Picking data from a record
  • Next by thread: Re: Picking data from a record
  • Index(es):
    • Date
    • Thread