AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Aborting a script

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
cger



Joined: 18 Jul 2009
Posts: 9

PostPosted: Sat Jul 18, 2009 8:08 pm    Post subject: Aborting a script Reply with quote

Hello,

I've been using a different macro software for while. This software allowed the termination of the macro regardless of what stage it's in. I'm looking for a certain built-in feature in AutoHotKey, or a way to program in the key to abort the macro.

I've seen a couple of threads mentioning the ExitApp function. Although it does really terminate the macro, it will not happen until all lines are executed. Example:
Code:

Esc::ExitApp
^t::
SetKeyDelay, 100
Send Line one{ENTER}
Send Line two{ENTER}
Send Line three
return

I may be using this function inappropriately so if it is the way to go, a short example would be appreciated. The objective is preventing a mess if something unpredictable happens during the execution of a long macro.

Is this possible in any way?

Thanks,

Tom
Back to top
View user's profile Send private message
Dbof



Joined: 13 Jan 2009
Posts: 31

PostPosted: Sat Jul 18, 2009 8:14 pm    Post subject: Reply with quote

It depends on the macro. But in most cases, you can abort a macro by adding a hotkey:

Code:
Esc::ExitApp   ;This exits the script whenever you press Escape
Back to top
View user's profile Send private message
cger



Joined: 18 Jul 2009
Posts: 9

PostPosted: Sun Jul 19, 2009 12:30 am    Post subject: Aborting a Script Reply with quote

Thanks Dbof,

This is the method I was referring to, but it didn't work even with the simplest example above. I tried adding the hotkey in various lines - before and after the main code, but regardless the hotkey executes only at the very end (after all 3 Sends are executed).

Tom
Back to top
View user's profile Send private message
evan1
Guest





PostPosted: Sun Jul 19, 2009 2:02 am    Post subject: Reply with quote

put some sleep in between, like:
Code:
Esc::ExitApp
^t::
SetKeyDelay, 100
Send Line one{ENTER}
sleep 1
Send Line two{ENTER}
sleep 1
Send Line three
return
Back to top
cger



Joined: 18 Jul 2009
Posts: 9

PostPosted: Sun Jul 19, 2009 3:10 am    Post subject: Reply with quote

Not as easy as I'd hoped but it works. I'll add the sleep command where the potential for problems is the greatest.

Thanks!

Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group