kylet90 Posted May 9, 2016 Posted May 9, 2016 Hi, I am trying to use the following script which, after running overnight I found gives a "Recursion error - limit reached" type of error. This is the code I am trying to use: Loop() Func Loop() ; Check if Powerpoint is running If ProcessExists("powerpnt.exe") Then Sleep(15000) Call("Loop") Else Run("C:\\scripts\\open.bat", "", @SW_HIDE) Sleep(10000) Send("U") Sleep(8000) Send("{F5}") Call("Loop") EndIf EndFunc ;Loop I found Recursion in the Wiki which gives an example on how it works, and how to work around it - but my script does not have any +1 type counter in there which i can implement an If x(limit) reached then Return ; ----Source:https://www.autoitscript.com/wiki/Recursion Any help would be really appreciated. Kyle
jguinch Posted May 9, 2016 Posted May 9, 2016 Recursion is not needed, you just have to use a loop (while...wend or do...until) While 1 Loop() WEnd Func Loop() If ProcessExists("powerpnt.exe") Then Sleep(15000) Else Run("C:\scripts\open.bat", "", @SW_HIDE) Sleep(10000) Send("U") Sleep(8000) Send("{F5}") EndIf EndFunc Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
rudi Posted May 10, 2016 Posted May 10, 2016 Hi. I can't see, why you use a separate function? While 1 If ProcessExists("powerpnt.exe") Then Sleep(15000) Else Run("C:\scripts\open.bat", "", @SW_HIDE) Sleep(10000) ; a winwait() / winwaitactive() / winactivate() might be a more robust approach Send("U") Sleep(8000) Send("{F5}") EndIf WEnd Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now