Sign in to follow this  
Followers 0
Brogsitter

Can you combine "text" + a variable to a new variable name?

9 posts in this topic

I havent found a solution for this issue so far, but I really wonder if this is possible somehow.

$counter = 0
$var_1 = "something"
$var_2 = "something else"

While 1 = 1
$counter = $counter + 1

MsgBox(1, ""var_" & $counter", ""var_" &counter"

WEnd

Any ideas or help will be appreciated.

Share this post


Link to post
Share on other sites



Take a look at the Assign() function :)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You can very likely do what you want to do using Arrays.

Dim $strings[5]
$Strings[0] = "Message 1"
$Strings[1] = "Message 2"
$Strings[2] = "Message 3"
$Strings[3] = "Message 4"
$Strings[4] = "Message 5"

For $i = 0 to 5
Msgbox(0,$Strings[$i], $Strings[$i])
Next
Edited by Paulie

Share this post


Link to post
Share on other sites

Thanks for the ideas. I will have a look at the stuff straight away.

Share this post


Link to post
Share on other sites

I havent found a solution for this issue so far, but I really wonder if this is possible somehow.

$counter = 0
$var_1 = "something"
$var_2 = "something else"

While 1 = 1
$counter = $counter + 1

MsgBox(1, ""var_" & $counter", ""var_" &counter"

WEnd

Any ideas or help will be appreciated.

have you tried swimming?

$counter = 0
$var_1 = "something"
$var_2 = "something else"

While 1 = 1
$counter = $counter + 1

MsgBox(1, $var_1 & " is " & $counter, var_2 & " is " & $counter)

WEnd

like this:

$value & "text"


0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites

have you tried swimming?

$counter = 0
$var_1 = "something"
$var_2 = "something else"

While 1 = 1
$counter = $counter + 1

MsgBox(1, $var_1 & " is " & $counter, var_2 & " is " & $counter)

WEnd

like this:

$value & "text"

Not what he was asking. He wanted to reference Var1 and Var2 with a counter

Share this post


Link to post
Share on other sites

OR you could try useing timerinit() and timerdiff() maybe thats not what you want but you could try

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I havent found a solution for this issue so far, but I really wonder if this is possible somehow.

$counter = 0
$var_1 = "something"
$var_2 = "something else"

While 1 = 1
$counter = $counter + 1

MsgBox(1, ""var_" & $counter", ""var_" &counter"

WEnd

Any ideas or help will be appreciated.

This appears to work.

Local $counter = 0
Local $var_0
Local $var_1 = "something"
Local $var_2 = "something else"

Assign("var_" & $counter, Eval("var_" & $counter + 2) & " Extra")

While $counter <> 3
    MsgBox(1, "var_" & $counter, "var_" & $counter & " = " & Eval("var_" & $counter))
    $counter = $counter + 1

WEnd

Edit: Added Assign() Function which was mentioned in an earlier post.

It adds to the possibilities of variables manipulation.

Edited by Malkey

Share this post


Link to post
Share on other sites

ok if your looking for a time func what i said would work lol what ever you need

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  
Followers 0