• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Variable creation by script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Variable creation by script


  • Subject: Variable creation by script
  • From: Paul Skinner <email@hidden>
  • Date: Mon, 29 Jan 2001 11:31:19 -0500

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


References: 
 >Re: Variable names on the fly? (From: Emmanuel <email@hidden>)

  • Prev by Date: Re: Network Setup Scripting Troubles
  • Next by Date: RE: Quark Find and Replace with variables (new question)
  • Previous by thread: Re: Variable names on the fly?
  • Next by thread: Re: Variable names on the fly?
  • Index(es):
    • Date
    • Thread