Sign in to follow this  
Followers 0
Anferny

Terminating a script

5 posts in this topic

Omg I can use this line of code to stop 2 scripts but I can't for a new one.

HotKeySet("{ESC}", "Quit")
Func Quit()
  Exit
EndFunc

Any ideas? I want to hit Esc to stop a script and Pause to pause it.

Share this post


Link to post
Share on other sites



Can you post the whole script please?

That code won't work because the program exits before it even has a chance to hit a hotkey.

Pause hotkeys usually just bring up a MsgBox and wait for the user to click it, once the user clicks it the script resumes, so:

HotKeySet("{ESC}", "Quit")
HotKeySet("{PAUSE}", "Pause")
While 1
    Sleep(1)
WEnd

Func Quit()
  Exit
EndFunc

Func Pause()
  MsgBox("","","Press OK to resume script")
EndFunc

Simple as that :lmao:


"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This is what the whole script should look like:

Msgbox( 0, "AutoIt", 'Press OK To Start The clicking. WARNING:You have 3 seconds to maximize IE!' )
;SplashTextOn ( 'AutoIt SpamBot', 'Hit Esc to stop', 100, 75 )
$coord = PixelSearch( 465, 390, 545, 490, 0x797170 )
If Not @error Then
$o = 0
While $o <29
        MouseClick("Left", $coord[0], $coord[1], 1, 5)
Sleep (8000)
wEnd
Endif

It's not working for some reason, it just flashes the: "Hit Esc to stop" and then ends. What am i doning wrong? It's supposed to click on a pixel with a hex thats listed above (i know for a fact that there is one there) and then click where it found it. It's supposed to do that 28times after sleeping for 8-9 seconds each time. Also is there a way to have it say somthing when it doesn't find that color? Like a If else else?

Edited by Anferny

Share this post


Link to post
Share on other sites

...you're exiting the script if the pixel is not found.

It doesn't wait at all unless the right pixel is found.


"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.

Share this post


Link to post
Share on other sites

I see. 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