Re: Working With Records
Re: Working With Records
- Subject: Re: Working With Records
- From: Geoff Graham <email@hidden>
- Date: Thu, 15 Jan 2004 18:02:44 -0500
At 11:19 AM -0500 15/01/04, Steven Valenti wrote:
set RecordNumber to "FirstRecord"
set TheRec to {FirstRecord:400, SecondRecord:800}
get RecordNumber of TheRec
You can use "run script" to turn strings into instructions, basically
what you are attempting to do. For instance, this "works":
----------------------
set RecordNumber to "FirstRecord"
run script "set TheRec to {FirstRecord:400, SecondRecord:800}
get " & RecordNumber & " of TheRec"
----------------------
In fact, this is very limited and/or tricky, because the script that
you will run in "run script" will run in its own context, and you it
may be difficult to have it share variables with the rest of the
script.
Usually, there are other techniques to achieve the same goals with
less hassle - you may want to tell us more about what you want to do.
Emmanuel
slightly less tricky would be this:
regular script:
set RecordNumber to "FirstRecord"
set TheRec to {FirstRecord:400, SecondRecord:800}
then you only have to build these kind of lines:
run script "get " & RecordNumber & " of TheRec of my parent"
or even:
run script "my parent's TheRec's " & RecordNumber
and:
set aValue to 600
run script "set my parent's TheRec's " & RecordNumber & " to " & aValue
since the "my parent" thing is still fresh in my mind from the recent
inheritance thread.
This would have helped me out a couple of years ago when I wanted to
use a record and settled for parallel lists.
geoff
_______________________________________________
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.