• 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
Re: Convert Text to Variable Name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Look-Up-Table (was Re: Convert Text to Variable Name)
      • From: Christopher Stone <email@hidden>
References: 
 >Convert Text to Variable Name (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: Posting scripts (was more scoping aggravation)
  • Next by Date: Re: Soap and Applescript
  • Previous by thread: Re: Convert Text to Variable Name
  • Next by thread: Look-Up-Table (was Re: Convert Text to Variable Name)
  • Index(es):
    • Date
    • Thread