AutoHotkey Community

It is currently May 26th, 2012, 8:14 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Unwanted script exiting
PostPosted: April 15th, 2005, 11:38 pm 
Offline

Joined: April 15th, 2005, 11:27 pm
Posts: 4
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 15th, 2005, 11:43 pm 
Offline

Joined: April 15th, 2005, 11:36 pm
Posts: 7
Location: Pakistan
Try
Code:
:*:s::
ExitApp


_________________
Intelligence helps, but hard work is the key to Success


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 16th, 2005, 12:41 am 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 16th, 2005, 1:08 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 16th, 2005, 2:44 am 
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.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, poserpro, sjc1000, Tilter_of_Windmills, Yahoo [Bot] and 58 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group