Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Once a script has been started, is there a way to stop it?


  • Please log in to reply
22 replies to this topic
Elias
  • Members
  • 3 posts
  • Last active: Sep 30 2009 03:23 AM
  • Joined: 29 Sep 2009
Forgive me if this has been covered, but I tried searching and could not find an answer.

Once a script has been started, is there a way to stop it?

I have very lengthy mouse clicking scripts. Occasionally something I did not anticipate ruins my scripts intended purpose. Since the mouse is going through the click actions with little to no hesitation (sleep), there is no way for me to pause or stop the script fast enough (via the task manager or task bar) since the mouse is unusable while the script is running.

doyle
  • Members
  • 335 posts
  • Last active: Mar 02 2012 04:47 PM
  • Joined: 14 Nov 2007
Put this hot-key in your script.

Press escape to stop it.

Escape::
ExitApp
Return


engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
I typically use

Esc::ExitApp

This will kill the script ASAP.

There are variations, but ExitApp is probably what you were looking for.

  • Guests
  • Last active:
  • Joined: --
Esc::ExitApp  ;Escape key will exit... place this at the bottom of the script

Also, you can use ANY key in place of the Esc key. See "key list" for usage.

Elias
  • Members
  • 3 posts
  • Last active: Sep 30 2009 03:23 AM
  • Joined: 29 Sep 2009
Wow! You guys are fast!

Thanks a lot :D

doyle
  • Members
  • 335 posts
  • Last active: Mar 02 2012 04:47 PM
  • Joined: 14 Nov 2007
Also, look into ControlClick, and PostMessage for potential ways on which your script could function without the mouse.

I used to have lots of "MouseClick" scripts, but now I try and avoid them where possible.

MouseClick's generally are unreliable when thinking about future developments, portability, and user preferences.

Basically, things arent always where you expect them to be.

If you can refer to them in a way which doesnt change, your scripts will be far more reliable.

Also, it looks a hell of a lot better. I find that scripts that make the mouse move a lot generally dont look great. :)

Elias
  • Members
  • 3 posts
  • Last active: Sep 30 2009 03:23 AM
  • Joined: 29 Sep 2009
Thanks for the tip! I will definitely be looking into that.
It seems like every time I go to write a new script I discover a new capability of AutoHotKey that amazes me, and I'm sure I haven't even cracked the surface of it's capabilities.

  • Guests
  • Last active:
  • Joined: --
I have tha same problem, but when I insert

Esc::ExitApp

or

Escape:: 
ExitApp 
Return

then WinActivate doesn't work.

Without Escape shortcut the script works.

Help!

  • Guests
  • Last active:
  • Joined: --
show us the full code that u are using that does not work

  • Guests
  • Last active:
  • Joined: --
Thank you

Pause::Pause

WinWait, Nuova scheda - Google Chrome,
IfWinNotActive, Nuova scheda - Google Chrome, , WinActivate, Nuova scheda - Google Chrome,
WinWaitActive, Nuova scheda - Google Chrome,

;clicco sulla tab
MouseClick, left, 114, 20
Sleep, 1000

msToWait=400
msLongWait=6000

x = -166
y = 0

Sleep msToWait
MouseClick, left, 75, 464

MouseClick, left, 377, 337
Sleep msToWait
MouseClick, left, 465, 310
Sleep msToWait
MouseClick, left, 411, 342
.
.
.



  • Guests
  • Last active:
  • Joined: --
If I delete the first line everything works properly...

None
  • Members
  • 3199 posts
  • Last active: Nov 05 2015 09:55 PM
  • Joined: 28 Nov 2009
Put it at the end of the script it's messing with the Auto-execute Section.

Machalik
  • Members
  • 23 posts
  • Last active: Nov 17 2010 09:58 PM
  • Joined: 07 Sep 2010
Is there a way how to terminate ANY script during its run without copying the Esc:ExitApp code into all of your scripts? Something that could probably go into the auto-execute section?

  • Guests
  • Last active:
  • Joined: --
Thank you a lot

I owe a beer to you...

Thank you again

None
  • Members
  • 3199 posts
  • Last active: Nov 05 2015 09:55 PM
  • Joined: 28 Nov 2009
@ Machalik do you mean other than right clicking on it's tray icon
AHKPanic() a function for Pausing, Suspending, or Closing all running scripts