Jump to content

Problems With For...next With Variable


Recommended Posts

hi@all,

problems with following script:

$start = InputBox("Start", "Bitte das Startvolume eingeben:")
If @error = 1 Then 
    Exit
EndIf   
$stop = InputBox("Stop", "Bitte das Endvolume eingeben:")
If @error =1 Then
    Exit
EndIf   

MsgBox(0,"Start & Stop",$start & " : " & $stop)

For $i = $start To $stop Step 1 
 MsgBox(0,"",$i)
Next

$start & $stop are numeric between 2 and 125...

this script only works ( for ... next ) , when $start and $stop is equal ...why ???

blumshuett

Edited by blumsguett
Link to comment
Share on other sites

It works for me.

Also, you dont need the "Step 1". Step 1 is the default.

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

i copy my sourcecode from this forum in a new x.au3 file...

F5 and nothing happend...

when i replace $start & $stop with ex. 6 and 125 it works...

i tried this script on 3 computers...

$start = 6
$stop = 10
 MsgBox(0,"Start & Stop",$start & " : " & $stop)
For $i = $start To $stop Step 1 
 MsgBox(0,"",$i)
Next

so it works too......

blumshuett

Link to comment
Share on other sites

  • Moderators

i copy my sourcecode from this forum in a new x.au3 file...

F5 and nothing happend...

when i replace $start & $stop with ex. 6 and 125 it works...

i tried this script on 3 computers...

$start = 6
$stop = 10
 MsgBox(0,"Start & Stop",$start & " : " & $stop)
For $i = $start To $stop Step 1 
 MsgBox(0,"",$i)
Next

so it works too......

blumshuett

Try making the string an integer:
$start = InputBox("Start", "Bitte das Startvolume eingeben:")
$stop = InputBox("Stop", "Bitte das Endvolume eingeben:")

If Int($start) <= Int($stop) Then
    For $i = Int($start) To Int($stop)
        MsgBox(0,"",$i)
    Next
Else
    MsgBox(0,'Error','$stop was greater than $start' & @CR & $start & " : " & $stop)
EndIf

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

Weird, why would it work on mine without forcing it to int?

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

  • Moderators

Weird, why would it work on mine without forcing it to int?

Didn't work on mine without doing it how I did it. Can't tell you really.

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...