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 

Unwanted script exiting

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



Joined: 15 Apr 2005
Posts: 4

PostPosted: Fri Apr 15, 2005 10:38 pm    Post subject: Unwanted script exiting Reply with quote

Certainly a simple question that probably has a simple answer:

I need to define a hotkey at the beginning of the script to exit the script at any time during execution. To do this i have simply added the following line at the start of the script:

s::ExitApp

When i try to run the script however, it exits the second it sees the hotkey declaration. Why?
Back to top
View user's profile Send private message
DrSamRaza_1



Joined: 15 Apr 2005
Posts: 7
Location: Pakistan

PostPosted: Fri Apr 15, 2005 10:43 pm    Post subject: Reply with quote

Try
Code:

:*:s::
ExitApp


_________________
Intelligence helps, but hard work is the key to Success
Back to top
View user's profile Send private message Send e-mail Visit poster's website
polyethene



Joined: 11 Aug 2004
Posts: 5248
Location: UK

PostPosted: Fri Apr 15, 2005 11:41 pm    Post subject: Re: Unwanted script exiting Reply with quote

Hound wrote:
When i try to run the script however, it exits the second it sees the hotkey declaration. Why?

Put a Return statement before the hotkey definition (otherwise it would act through it). It doesn't matter where hotkeys are in a script; use #Persistent for hotkey-driven scripts.
_________________
GitHubScriptsIronAHK Contact by email not private message.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Sat Apr 16, 2005 12:08 am    Post subject: Reply with quote

Unlike normal labels, into which the auto execute section will fall if there is no "return" to stop them, hotkeys and hotstrings will implicitly end the auto execute section.

In light of this, I'm not sure what the problem could be in this case, nor can I reproduce it. Perhaps you pressed the letter S accidentally?
Back to top
View user's profile Send private message Send e-mail
Guest






PostPosted: Sat Apr 16, 2005 1:44 am    Post subject: Reply with quote

Thanks for the help. I just put the hotkey definition at the end of the script instead of the beginning. Although this should not make a difference ( I suppose) because hotkeys are processed at script load (?), the script works perfectly now.
Back to top
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