Re: Picking data from a record
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