Jump to content
Sign in to follow this  
magaf

variable as a variable's name?

Recommended Posts

is that possible ?

example

$x = abc

$($x) = def

so the var $abc contains def

Edited by magaf

Share this post


Link to post
Share on other sites

thanks for responding through im yet to find a solution for what i ment, the variable content is unknown (the reason i want to make variable (ehich will refer to its content) as a variable's name) so i cant use assign

Share this post


Link to post
Share on other sites

Many thanks for this dialogue. Eval satisfies my need for indirection. Coincidentally, I was searching for the same thing.


Jay

Share this post


Link to post
Share on other sites

thanks , that solved it. btw can i do this with arrays also? (array's name would be a variavle's content (thats basicly what i wanted to achieve))

Share this post


Link to post
Share on other sites

can i make envierment variable arrays and if not what other is there other way to do variable as a variable's name or cant it be done yet with autoit?

Share this post


Link to post
Share on other sites

variable as a variable's name

<{POST_SNAPBACK}>

$x = "abc"
Assign($x, $x)
MsgBox(0, "", Eval($x))

As Cyberslug, you need the latest unstable version to make it work.

Available below.

http://www.autoitscript.com/autoit3/files/unstable/autoit/

Edit 1:

Made a good example.

Edit 2:

I just checked your first post...

Here's the working version of your example.

$x = "abc"
Assign($x, "def")

var $abc contains "def" (without quotes)

Edited by SlimShady

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...