Jump to content

Combine 2 variable names in "for" command.


 Share

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"

Next

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

but doesnt seem to wok

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

Link to comment
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])
Next

oÝ÷ Ù«­¢+Ø(ÀÌØíÙÈÄôÅÕ½Ðí¡¤ÅÕ½Ðì(ÀÌØíÙÈÈôÅÕ½Ðíµä¹µ¥ÌÅÕ½Ðì(ÀÌØíÙÈÌôÅÕ½ÐíÑ¡ÑÍÉÐÈÌÐÔÅÕ½Ðì)5Í    ½à À°ÅÕ½Ðí
½µ¥¹¥¹YÉ¥±ÌÅÕ½Ðì°ÀÌØíÙÈĵÀìÀÌØíÙÈȵÀìÀÌØíÙÈ̤(
Edited by thatsgreat2345
Link to comment
Share on other sites

  • Moderators

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)

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...