Re: Variable creation by script
Re: Variable creation by script
- Subject: Re: Variable creation by script
- From: email@hidden
- Date: Mon, 29 Jan 2001 14:43:26 EST
The parent script knows nothing of any variable called testList1. Try this
instead:
set listIndex to "1"
--> "1"
set scripttext to "set testList" & listIndex & " to {\"a\",\"b\"}"
tell current application to run script "set testList1 to {\"a\",\"b\"}"
--> {"a", "b"}
set myTestList1 to run script scripttext
--> {"a", "b"}
return myTestList1
--> {"a", "b"}
or you could just "return," in which case the result is passed. I prefer
using variable to hold data though - result is too ethereal.
Jeff Baumann
email@hidden
www.linkedresources.com
Comparing MHz between the G4 and Pentium is like comparing the popular vote
between Bush and Gore; it's interesting, but it isn't what matters.
In a message dated 1/29/01 10:36:28 AM, you wrote:
>
Ok, I've tried this repeatedly, and I've searched the archives that I
>
have available locally including the 'variables on the fly' thread. I must
>
be missing something basic.
>
I want to create a variable within a script and assign it a value. This
>
I can do. But when I subsequently query that variable it errors as not
>
defned.
>
>
Here's the simple example that I'm working on.
>
>
--Begin script
>
set listIndex to "1"
>
--> "1"
>
set scripttext to "set testList" & listIndex & " to {\"a\",\"b\"}"
>
-->tell current application to ,
>
--> run script "set testList1 to {\"a\",\"b\"}"
>
--> {"a", "b"}
>
run script scripttext
>
--> {"a", "b"}
>
return testList1
>
--> The variable testList1 is not defined.
>
>
--End script
>
>
Now, I've tried making the variable global in the defining script object
>
and I've tried creating it as a property. Neither changes the result. I
>
tried holding my mouth crooked when I run it, and I shook my rubber chicken
>
at the box repeatedly. What have I forgotten?
>
--
>
Paul Skinner