Jump to content

Recursion level has been exceeded?


Recommended Posts

So I am writing a script and I am at a point where I have a variable, I want to add 1 to that variable, then do a quick process with that variable, then repeat, but when I write something as simple as this:

Folder()

Func Folder()
$Count += 1
;Insert quick function using $Count here
If $Count < 15000 Then
Folder()
Else
NextFunc()
EndIf
EndFunc

Func NextFunc()
;Insert anything you want here
EndFunc

AutoIT will stop because "Recursion level has been exceeded - AutoIt will quit to prevent stack overflow." after about 3,898 recurrences consistently. The problem is I want to run this for 10,000-100,000 times. Is there anyway to circumvent this limitation?

Edited by cheeseandcereal
Link to comment
Share on other sites

Recursion is not a cool technique. Why not try looping?

$Count = 0

Func _MyFunc()
While $Count < 15000
$Count = $Count + 1
;Do something with $Count here
WEnd
EndFunc

Func _NextFunc()
;Anything you wanna do!!!
EndFunc

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Link to comment
Share on other sites

cheeseandcrereal,

This follows the logic of your post, although it makes no sense outside of the context of the rest of your script.

for $Count = 1 to 15000
    Folder()
Next

NextFunc()

Func Folder()
    ; do something
EndFunc   ;==>Folder

Func NextFunc()
    ;Insert anything you want here
EndFunc   ;==>NextFunc

Are you trying to run folders and files?

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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