Sign in to follow this  
Followers 0
Bi0haZarD

max of 1 million on for to statements?

6 posts in this topic

#1 ·  Posted (edited)

ok, i'm making a script with a GUI that has start/stop numbers. when the user types in anything higher then 1million (1000000) then the program halts and you have to right click the icon in the system tray to exit out.

heres a portion of my script that deals what happens when the user hits "start"

Case $msg = $Buttonstart
     $istart = GUICtrlRead($inputstart)
     $istop = GUICtrlRead($inputstop)
     $iext = GUICtrlRead($inputext)
     $ipath = GuiCtrlRead($InputFolder)
     $ifile = GuiCtrlRead($InputFile)
     $count = 1
    for $i = $istart to $istop
        If FileExists($ipath & $ifile & $i & $iext) Then
            ClipPut($ipath & $ifile & $i & $iext)
            GUICtrlSetData($Listbox,$ipath & $ifile & $i & $iext)
            $count = $count+1
        Else            
        $count = $count+1
    EndIf
    GuiCtrlSetData($Labelcurr,"Current File: " & $ipath & $ifile & $i & $iext)
    next

please note what i did wrong, if i put 999999 for the stop number then it doesn't have a problem, only when its 1000000 or higher then it halts.

if i manually set the stop number by putting:

for $i = $istart to 4000000

then it doesn't have a problem...

thanks :)

Edited by Bi0haZarD

Share this post


Link to post
Share on other sites



try wrapping the GUICtrlRead functions with Int(). I believe that its passing the text as a string, and not a number.


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Thanks a lot MSLx that fixed it. just to test it i tried 90 million and it still worked =)

thanks a lot

Share this post


Link to post
Share on other sites

Can I ask why you needed to loop something more than a million times? I don't think I've ever heard of an array even 1/10 that size loaded into memory :)


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

needed some way to increment file names for my script "ReSave" as seen here

since the recovery program that i used renamed files to "cluster ######.JPG" the cluster number refering to where the picture was on the hard drive.. so the max number could be really high depending on the size of the hard drive and where the image was located on the drive.

Edited by Bi0haZarD

Share this post


Link to post
Share on other sites

Oh :)


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

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