Jump to content
Sign in to follow this  

Combine 2 variable names in "for" command.

Recommended Posts

In LUA you can in a FOR loop combine a variable with the current in the loop like;

for i=9,0,-1 do VAR = "hello"

is it possible to do this in autoit?

The first thing that came to my mind was

For $i = 5 to 1 Step -1

$VAR[$i] = "hej"


MsgBox(0,"", $VAR1, $VAR2, $VAR3, $VAR4, $VAR5)

but doesnt seem to wok

[center][u]WoW Machinima Tool[/u] (Tool for Machinima Artists) [/center]

Share this post

Link to post
Share on other sites

add an & sign for example

for loop example

Global $var[4]
$var[1] = "hi "
$var[2] = "my name is "
$var[3] = "thatsgreat2345"
For $i = 1 to 3
MsgBox(0,"Combining Variables",$var[$i])

Edited by thatsgreat2345

Share this post

Link to post
Share on other sites

Not really understanding what you're getting at, but I wouldn't doubt it doesn't work, You didn't declare your Array, you didn't use the Array in the msgbox (the numbers in brackets) and you have too many parameters for your msgbox

Dim $Array[10], $blah
For $i = 9 To 0 Step - 1
    $Array[$i] = 'SomeText ' & $i
    $blah &= $Array[$i] & @CR
$blah = StringTrimRight($blah, StringLen(@CR))
MsgBox(64, 'Info', $blah)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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  

  • Create New...