Sign in to follow this  
Followers 0
malu05

Combine 2 variable names in "for" command.

3 posts in this topic

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"

Next

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



#2 ·  Posted (edited)

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])
Next

oÝ÷ Ù«­¢+Ø(ÀÌØíÙÈÄôÅÕ½Ðí¡¤ÅÕ½Ðì(ÀÌØíÙÈÈôÅÕ½Ðíµä¹µ¥ÌÅÕ½Ðì(ÀÌØíÙÈÌôÅÕ½ÐíÑ¡ÑÍÉÐÈÌÐÔÅÕ½Ðì)5Í    ½à À°ÅÕ½Ðí
½µ¥¹¥¹YÉ¥±ÌÅÕ½Ðì°ÀÌØíÙÈĵÀìÀÌØíÙÈȵÀìÀÌØíÙÈ̤(
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
Next
$blah = StringTrimRight($blah, StringLen(@CR))
MsgBox(64, 'Info', $blah)


[center]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.[/center]

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