Re: Picking data from a record
Re: Picking data from a record
- Subject: Re: Picking data from a record
- From: Joseph Weaks <email@hidden>
- Date: Fri, 24 Sep 2004 12:05:02 -0500
On Sep 24, 2004, at 8:46 AM, John Fountain wrote:
I have a list of items. I want to pick one of the items from the list and if that item's contents corresponds to the name of one of the variables in a record I want a variable to be set with the contents of that variable in the record. Does that make sense?
There is no dynamic hash array built into appplescript; that's the problem. But, while I'm not recommending it, there is life without Smile. It just takes creative use of the run script command to turn text into an object.
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 "set tempRecord to parent's testRecord
" & testThis & " of tempRecord"
-- Height
Notice the carriage return is part of the run script string. You can add a try block to the run script text in order to catch errors when testThis is not in testRecord.
Cheers,
Joe Weaks
_______________________________________________
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