Sign in to follow this  
Followers 0
cheeseandcereal

Recursion level has been exceeded?

4 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Haha now I feel stupid! I knew there was some sort of loop that could do this for me I just couldn't remember what it was for some reason. Brain fart :)

Thanks

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