Re: Convert Text to Variable Name
Re: Convert Text to Variable Name
- Subject: Re: Convert Text to Variable Name
- From: Skeeve <email@hidden>
- Date: Mon, 17 Jan 2011 21:16:18 +0100
Am 14.01.11 22:04, schrieb Christopher Stone:
Hey Folks,
It seems to me there's a way to convert text to a declared variable
name, but I can't remember how.
I do not think it is a good idea to use "run script".
Why not somethin along these lines:
on run
-- These are my variables to choose from
set myVar1 to "Variable 1"
set myVar2 to "Variable 2"
-- here is the lookup table
set lookup to {{nam:"a", var:a reference to myVar1}, ¬
{nam:"b", var:a reference to myVar2}}
-- now the testloop
repeat
-- let user select a or b for var1 or 2
set chosen to choose from list {"a", "b"}
-- cancel makes the program quit
if chosen is false then exit repeat
-- take what was selected
set chosen to first item of chosen
-- try to find the associated variable
repeat with myvar in lookup
-- if it is found
if myvar's nam is chosen then
-- display it
display dialog myvar's var
exit repeat
end if
end repeat
end repeat
end run
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden