rawkhopper Posted May 27, 2020 Posted May 27, 2020 Hello guys and girls, I have a script I have been working on. I finally figured out how to avoid the dreaded stack overflow issues I was having with my loops. Now I find myself in the awkward position of not knowing how to safely stop my loops without closing my GUI. When the script ends I want the GUI to just sit there as is until someone hits the close button. If I do: While 1 Sleep (1000) WEnd Will that cause a recursion level has been exceeded error eventually or is this safe to run indefinitely?
ViciousXUSMC Posted May 27, 2020 Posted May 27, 2020 There is no recursion in that loop its not back referencing anything it can run forever. Depending on the script you may want a lower sleep value as a full second can cause some erratic behavior, even a small sleep is enough to save a lot of cpu cycles.
Aelc Posted May 27, 2020 Posted May 27, 2020 If there are more than 1 script at the same time you could use Do Sleep ( 50 ) Until Processexists("script1.exe") <> True inside the same script you could use Exitloop to keep the script alive and getting out of the loop. But leaving the loop without having another will end the script and the GUI... You could also use a trigger like $trigger = True While $trigger sleep(50) If Processexists("script1.exe") <> True then $trigger = False Wend hope that helps why do i get garbage when i buy garbage bags?
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