Re: string as key to record
Re: string as key to record
- Subject: Re: string as key to record
- From: Malcolm Fitzgerald <email@hidden>
- Date: Fri, 20 Sep 2002 11:43:18 +1000
At 11:43 PM +0100 16/9/02, John Delacour wrote:
At 2:05 pm -0700 16/9/02, john mead wrote:
Is it possible to use a string as a key to a record?
Is there a coercion that would work here?
set myRecord to {thingOne:"blah"}
set myKey to "thingOne"
get myKey of myRecord
set varKey to "a"
set varVal to "3"
set varRecord to run script "
{" & varKey & ":" & varVal & "}"
return a of varRecord
-- JD
John's script does not work if varVal is a string. The script sees an
unquoted string value, expects that to be a variable and complains
that the variable is undefined. Including the quotes in the
concatenation fixes it.
set varKey to "a"
set varVal to "3"
set varRecord to run script "
{" & varKey & ":" & "\"" & varVal & "\"" & "}"
return a of varRecord
--
--
Malcolm Fitzgerald email@hidden
Database Manager
http://www.asauthors.org
The Australian Society of Authors ph: 02 93180877 fax: 02 93180530
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.