Jump to content

Problem With Variable In The For Expression


Recommended Posts

hi,

For $i=1 to 18 Step +1

blabla()

next

that does work

but if i take variables, instead of numbers, it does not uses the for count, while compiling there is no error.

for example: that does not work

dim $test1, $test2

$test1=3

$test2=15

For $i= $test1 to $test2 Step +1

blabla()

next

does anyone know what is wrong?

or is it a bug?

thanks

Link to comment
Share on other sites

First... You can get rid of the Step part of your for loop. The default is to step by positive 1.

Secondly, AutoIt allows variables to be created on the fly, so you dont need to Dim those variables unless you want to.

This works for me:

$Var1 = 10
$Var2 = 15

For $i = $Var1 to $Var2
    MsgBox(0,"For Test","Current $i value is: "&$i)
Next
Edited by Simucal
AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

Just to completely answer you question:

dim $test1, $test2
$test1=3
$test2=15

For $i= $test1 to $test2 Step +1
MsgBox(0,"For Test","Current $i value is: "&$i)
next

Works for me also. It looks like the problem might lie in the function you are calling with the For loop.

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
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...