Elyonne

Force quit a script gone rogue?

4 posts in this topic

Basically, my script was paused with a message waiting for response. I was looking at my code and forgot and pressed F1  and immediately my script resumed and couldn't be stopped. My hot key to pause it wasn't working, CTRL + Break wasn't working, ALT + F4 worked on everything BUT the actual macros... I couldn't try anything else because my script is very click intensive with little rest by design. I managed to click on the message and still couldn't stop the thing. I had to reboot.

Why does this happen and can I stop my script if it goes cray cray?

This is my hot key code:

HotKeySet("{ESC}", "_HoldUp")


Func _HoldUp()
    $ans = MsgBox(0, "What Next?", "Pause script??", 3)
    If $ans = 1 Then $ans = MsgBox(2, "Paused", "Stop executing | Skip to next | Continue")
    Select
        Case $ans = 3
            Exit
        Case $ans = 4
            $f_dis = 1
        Case $ans = 5
            Sleep(1500)
    EndSelect

EndFunc   ;==>_HoldUp

 


new to AutoIt and online forums, so I apologize in advance for being annoying.

Share this post


Link to post
Share on other sites



Blocking functions will hold the execution of another function (hotkey)

Example would be a msgbox() you can terminate the script but it wont actually exit until you click on the messagebox so that the script proceeds to the next command. 

If you want a true bail out option for script testing purposes probably make a .bat file with taskkill or powershell with get-process | close-process that will close any open autoit processes.  Or another Autoit Script that does this.

Share this post


Link to post
Share on other sites

Open up TaskManager and kill the AutoIt.exe process(es)


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

I use this piece for my scripts.

HotKeySet("{ESC}", "Terminate")


Func Terminate()
    Exit
EndFunc   ;==>Terminate

 

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