Sign in to follow this  
Followers 0
stfields

Pausing Scripts

7 posts in this topic

This is the code included in the help file plus the edit to remove unwanted functions

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused
HotKeySet("!a", "TogglePause")

;;;; Body of program would go here;;;;
While 1
    Sleep(100)
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
     WEnd
EndFunc

The TogglePause function is never being called when I hit the assigned hotkey. I really don't care what the hotkey is... but I didn't want Escape. I've tried:

HotKeySet("!a", "TogglePause")

HotKeySet("{TAB}", "TogglePause")

HotKeySet("{!a}", "TogglePause") <--- just in case !a needed the brackets (didn't think it did)

To verify that it enters the loop command, I have a Send(".") in the Pause loop and a Send("x") in the Body loop that I'll view via Notepad. I commented out the Tooltips because I didn't believe them to be necessary.

I am having this run behind an application that doesn't minimize (It won't return control through Alt-Tab). That is just for reference in case that is the problem.

I am understand that the HotKeySet should NOT pass the keypresses to the application unless I use the "capture" type functions. However, they still do pass.

Any ideas what is amiss? Thanks in advance for whatever help you can offer.

Share this post


Link to post
Share on other sites



Is said application a game?

Share this post


Link to post
Share on other sites

Aye. I am reluctant to divulge further info unless it would prove useful due to seeing another poster getting "flamed."

Share this post


Link to post
Share on other sites

Then the problem is likely the game is trapping the keys.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I figured that since the keys were still being "echoed" on-screen, that they weren't being passed through.

Is there a known work around? If not, thanks for replying so quick :D

***edit: typo***

Edited by stfields

Share this post


Link to post
Share on other sites

Hi,

This works for me. Tried with the following code:

Global $Paused
HotKeySet("!a", "TogglePause")

;;;; Body of program would go here;;;;
While 1
   Sleep(1000)
   MsgBox(0,"Not Paused", "Not Paused")
WEnd
;;;;;;;;

Func TogglePause()
   $Paused = NOT $Paused
   While $Paused
       sleep(100)
    WEnd
EndFunc

Are you sure hotkey combination ALT + a is not reserved by some other application?

Tuape

Share this post


Link to post
Share on other sites

Hi,

This works for me. Tried with the following code:

Global $Paused
HotKeySet("!a", "TogglePause")

;;;; Body of program would go here;;;;
While 1
   Sleep(1000)
   MsgBox(0,"Not Paused", "Not Paused")
WEnd
;;;;;;;;

Func TogglePause()
   $Paused = NOT $Paused
   While $Paused
       sleep(100)
    WEnd
EndFunc

Are you sure hotkey combination ALT + a is not reserved by some other application?

Tuape

I can confirm: this works here too.

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  
Followers 0