KenNichols

Recursion level has been exceeded

8 posts in this topic

This script works good but I get the following message after a few minutes.

Line 54 (File "C:\Program Files (x86)\Automatic Access\Automatic Access.exe"):

Error: Recursion level has been exceeded - AutoIt will quit to prevent stack overflow.

I have read other posts about this message and I have changed the script several times to try to fix it. However for some reason I can't wrap my head around this problem. What am I doing wrong?

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=Internet.ico
#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Res_Description=Automation utility for VZ Access Manager
#AutoIt3Wrapper_Res_Fileversion=1.1.0.0
#AutoIt3Wrapper_Res_LegalCopyright=© 2011 Ken Nichols
#AutoIt3Wrapper_Res_Language=1033
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include<Misc.au3>
If _Singleton(@ScriptName,1) = 0 Then Exit MsgBox(48,"","Automatic Access is already running.",3)

If @Compiled = 1 And FileExists(@ProgramFilesDir & "\Automatic Access\" & @ScriptName) = 0 Or @Compiled = 1 And FileExists(@StartupDir & "\Automatic Access.lnk") = 0 Then
    $Install = MsgBox(32+4,"Automatic Access","Do you want to install Automatic Access?")
    Select
        Case $Install = 6
            _Install()
            MsgBox(64,"Automatic Access","Automatic Access is now installed.")
        Case $Install = 7
            MsgBox(16,"Automatic Access","Automatic Access installation was cancelled!")
            Exit
        Case Else
            MsgBox(0,"Else","Else")
    EndSelect
EndIf

If FileExists(@ProgramFilesDir & "\Verizon Wireless\VZAccess Manager\VZAccess Manager.exe") Then
    $VZDir = @ProgramFilesDir & "\Verizon Wireless\VZAccess Manager\VZAccess Manager.exe"
ElseIf FileExists(@ProgramFilesDir & " (x86)\Verizon Wireless\VZAccess Manager\VZAccess Manager.exe") Then
    $VZDir = @ProgramFilesDir & " (x86)\Verizon Wireless\VZAccess Manager\VZAccess Manager.exe"
EndIf

ProcessSetPriority(@AutoItPID,1);Set Priority to "Below Normal"

While 1
Sleep(250)
_VZDetect()
WEnd

Func _VZDetect()
$var = DriveGetDrive( "CDROM" )
If NOT @error Then
     For $i = 1 to $var[0]
        $Label = DriveGetLabel($var[$i])
        $Status = DriveStatus($var[$i])
    If $Label = "VZAccess Manager" And $Status = "Ready" And ProcessExists("VZAccess Manager.exe") = 0 Then
        Run($VZDir)
        WinWait("VZAccess Manager","")
            If WinExists("AutoPlay","VZAccess Manager") Then
                WinClose("AutoPlay","VZAccess Manager")
            EndIf
        Sleep(200);Allow time for window to load
            While ControlCommand ("VZAccess Manager","", 1003,"IsEnabled","") = 0 ;And WinExists("VZAccess Manager","") = 1
                Sleep(200)
            WEnd
                If WinExists("AutoPlay","VZAccess Manager") Then
                    WinClose("AutoPlay","VZAccess Manager")
                EndIf
                    Sleep(200)
                    ControlClick("VZAccess Manager","",1003);Click Connect
                    Sleep(2000)
                    ControlClick("VZAccess Manager","",1046);Click Minimize - WinSetState ("VZAccess Manager","",@SW_MINIMIZE)Doesn't minimize to systray
EndIf
    Next
EndIf
EndFunc

Func _Install()
    If @Compiled = 1 And FileExists(@ProgramFilesDir & "\Automatic Access\" & @ScriptName) = 0 Then
        FileCopy(@ScriptFullPath, @ProgramFilesDir & "\Automatic Access\", 9) ; Flag = 1 + 8 (overwrite + create target directory structure)
        Sleep(100)
    EndIf

    If @compiled = 1 And FileExists(@StartupDir & "\Automatic Access.lnk") = 0 And FileExists(@ProgramFilesDir & "\Automatic Access\" & @ScriptName) = 1 Then
        FileCreateShortcut(@ProgramFilesDir & "\Automatic Access\" & @ScriptName, @StartupDir & "\Automatic Access.lnk","","","",@ProgramFilesDir & "\Automatic Access\" & @ScriptName,"","0")
        Sleep(100)
    EndIf
EndFunc

[topic="21048"]New to AutoIt? Check out AutoIt 1-2-3![/topic] Need to make a GUI? You NEED KODA FormDesigner!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This explains a little more about Recursion >> http://www.autoitscript.com/wiki/Recursion from Melba23.

Use RunWait() and not Run() OR it could be the ControlCommand for the While..WEnd Loop.

Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

This explains a little more about Recursion >> http://www.autoitscript.com/wiki/Recursion from Melba23.

Use RunWait() and not Run() OR it could be the ControlCommand for the While..WEnd Loop.

I added an IF statment in While 1 and so far so good. Thanks for the help.


[topic="21048"]New to AutoIt? Check out AutoIt 1-2-3![/topic] Need to make a GUI? You NEED KODA FormDesigner!

Share this post


Link to post
Share on other sites

Ken,

I don't see that you are using any "recursion" (unless it is happenning within the "controlcommand" as guinness seems to be suggesting).

Have you tried identifying where your code is spending most of it's time?

Also...just a suggestion...if you use "tidy" (CRLF-T) the code is easier to read.

Please update this post with the solution when you find it!

Thanks,

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

#5 ·  Posted (edited)

Hello all. was testing one script but after a while got that recursion level exceeded thing. looked for info but since noob on this it only confuses me  :ermm: if some one can please help to sort this one. any advice would be great.

know that game type scripts not allowed but think that this one is harmless.

basically what i wanna do is get sound notifications if someone sends a private message that's all. o:)

<snip>

Edited by Melba23
Code removed

Share this post


Link to post
Share on other sites

For which game is it?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Wartune, the game has its own notifications but there's way to many bugs that includes sound issues so most of players same as my self got mute sounds.

Share this post


Link to post
Share on other sites

crashas

Welcome to the AutoIt forum. :)

 

know that game type scripts not allowed

Correct. :)

but think that this one is harmless

Wrong. :(>

There is absolutely no flex - game interaction scripts are not allowed. Thread locked. :naughty:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.