Jump to content

How to stop while loop without stopping script?

Recommended Posts


Hello everyone,

I'm new and i really like programming. Now i am making a bot for orteil.dashnet.org/cookieclicker/  .
Here is the script I have now:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\Silas Peters\Desktop\Bots\Cookie Clicker.kxf
Global $Form1 = GUICreate("Cookie Clicker Bot", 267, 87, -1, -1)
Global $Start = GUICtrlCreateButton("Start", 160, 48, 75, 25)
Global $Stop = GUICtrlCreateLabel("Om te stoppen druk op de 'ESC' knop", 40, 16, 182, 17)
Global $Internet = GUICtrlCreateButton("Open Coockie Clicker", 24, 48, 123, 25)
#EndRegion ### END Koda GUI section ###

Global $g_bPaused = False
HotKeySet("{ESC}", "Stop")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
         Case $start
         Case $Internet

Func Start()
While 1
    MouseClick ("left", 215, 379)

 Func Internet()
    ShellExecute ("http://orteil.dashnet.org/cookieclicker/")
    WinWaitActive ("" , "Chrome Legacy Window" )
    Sleep (3000)
    WinActivate ("Cookie Clicker Bot")

 Func Stop()


But i want that if you press ESC that the spamming stops but that the window still stay's open so you can manually restart it...
Can anyone help me? And also, if you guy's know it too, can you tell me how i can keep the window of the bot in front all the time while the website is starting?

I would really apreciate it if you guy's can help me.


P.S. I'm actually dutch so sorry if i make some mistakes in grammar...

Share this post

Link to post
Share on other sites

@Silas welcome to the forum. You seem to have missed the forum rules on your way in, especially the parts about game automation. Please read them now (along with the section on not reposting your same question with different wording), and you'll see why this thread was locked. Hope to see you again with a legitimate question.

√-1 2^3 ∑ π, and it was delicious!

Share this post

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


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.