Jump to content
Sign in to follow this  
tom13

Emergency Exit

Recommended Posts

tom13

Hi,

I want to let my script stop and exit immediately when I press the pause button... so I made this and bound it to the pause key:

Func Quit()
Exit
EndFunc

But when a piece of code/script is still in the "queue" it first executes it and then exits, but I want it to stop all actions immediately and quit immediately, without completing the current action... is this possible?

Thanks in advance.

Share this post


Link to post
Share on other sites
Mast3rpyr0

dont make it a function but in a switch

$Quit = {Pause} ; How ever you check for hotkeys
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
        Case $Quit
            Exit
EndSwitch
WEnd

not sure if this will work any differently but thats all i can think of.

EDIT: maybe this will work?

Edited by Mast3rpyr0

Share this post


Link to post
Share on other sites
tom13

that way I can't bind it to the <pause> key, can I?

Share this post


Link to post
Share on other sites
Achilles

Hi,

I want to let my script stop and exit immediately when I press the pause button... so I made this and bound it to the pause key:

Func Quit()
Exit
EndFunc

Using GuiEventMode is more efficient (or so I've heard) then a normal loop, and also actions are taken immediately when an event happens. Also, the part I like, is that this mode keeps buttons and other changes out of the main loop which can let you put other things in there that aren't on event.

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites
Busti

hotkeyset( "{esc}" , "Quit" )

func Quit()

exit

endfunc


My UDF's : Startet on : 06.06.2006_CaseSearchOrReplaceStr();~> Searches OR Replaces a String,;~> With or Without Casesensivity

Share this post


Link to post
Share on other sites
Valuater

hotkeyset( "{esc}" , "Quit" )

func Quit()

exit

endfunc

If you are using GUIGetMsg(), the above should work almost immediately

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
Busti

if a messagebox or smt. is running, the hotkeyset will still be executet :)


My UDF's : Startet on : 06.06.2006_CaseSearchOrReplaceStr();~> Searches OR Replaces a String,;~> With or Without Casesensivity

Share this post


Link to post
Share on other sites
tom13

Alot of people are talking about improving it with GUI options, this is not what I want because my script is more some kind of a daemon which runs in the background, without a interface (gui)..

Also, for those who say that it should exit immediately:

When it is sending a long story with Send("long story here....") and you give it the command to exit, it first sends the full story and then exits. What I want is that it cancels the current action (sending the story) and immediately exit, without a GUI :)

Share this post


Link to post
Share on other sites
Valuater

Then maybe you, as this scripts designer, need to rewrite how the send() is handled, Just as an idea, how about sending 1 line at a time? Then the script may quit immediately

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
GaryFrost

Send 1 character at a time in a loop, that way the most that should get sent when exit is sent is 1 character.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites
tom13

But my story is very long, so I have to make like 100000000 lines with Send() ?

That seems quite... unprofessional :)

Share this post


Link to post
Share on other sites
NELyon

You can ProcessKill the autoit3.exe process

Share this post


Link to post
Share on other sites
GaryFrost

But my story is very long, so I have to make like 100000000 lines with Send() ?

That seems quite... unprofessional :)

Unprofessional is not reading the help and finding functions like "StringSplit" and "For....Next" and arrays


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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  

×