Jump to content
Sign in to follow this  
icarrion

Assign Dynamic Variables

Recommended Posts

icarrion

I would like to be able to dynamically assign a variable name like so:

array1 = StringSplit("Var1 Value"," ")

So that "Var1" is a variable name that contains the data "Value". So that I can do the following:

If $var1 = "value" Then

blah

EndIf

Is this at all possible? I know I can do the below instead but it makes the code ugly IMO.

array1 = StringSplit("Var1 Value"," ")

If $array1[1] = "value" Then

blah

EndIf

Any suggestions?

Edited by icarrion

Share this post


Link to post
Share on other sites
jvanegmond

Yes. Use the function Assign(). I'm sure it is in the Beta helpfile but i don't know about the release version. Assign() in the helpfile can also link you to other functions that things like designating variables from strings.

Edit: Execute may also be a good function to look up.

Edited by Manadar

Share this post


Link to post
Share on other sites
dabus

What about assign? (Damn, I'm too late :) )

Or you could put your code into an own function, so your script isn't bloated.

Edited by dabus

Share this post


Link to post
Share on other sites
icarrion

Yes. Use the function Assign(). I'm sure it is in the Beta helpfile but i don't know about the release version. Assign() in the helpfile can also link you to other functions that things like designating variables from strings.

Edit: Execute may also be a good function to look up.

Thanks guys!!!!!!!!!!!!

Share this post


Link to post
Share on other sites
GaryFrost

Yes. Use the function Assign(). I'm sure it is in the Beta helpfile but i don't know about the release version. Assign() in the helpfile can also link you to other functions that things like designating variables from strings.

Edit: Execute may also be a good function to look up.

At this point and time pretty much everything that is in beta is in the latest release.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.