Jump to content

What can cause HotkeySet to not capture the key?


Recommended Posts

What can cause HotkeySet to not capture the key?

 

I have these codes:

GLOBAL $CLOCK = TimerInit()
GLOBAL $PAUSE = 0
func SetTimeOut ($t)
    return( TimerDiff($CLOCK)-$PAUSE+$t )
EndFunc

func IsTimeOut ($t)
    return( ($t - TimerDiff($CLOCK) + $PAUSE) <= 0 )
EndFunc

func TogglePause ()
    local static $toggle = 0
    if $toggle=0 Then
        $toggle = TimerInit()
        while $toggle>0
            Print("PAUSED! Press {PAUSE} to continue.")
            sleep(100)
        wend
    Else
        $PAUSE += TimerDiff($toggle)
        $toggle = 0
    EndIf
EndFunc

func ABORT ()
    Print("ABORT")
    sleep(1000)
    exit(-1)
EndFunc

HotKeySet( "{PAUSE}", "TogglePause" )
HotKeySet( "{END}",   "ABORT" )

It works flawlessly for minutes/hours.
Then all of a sudden, they don't work anymore. They do not capture "PAUSE" nor "END" keys. Sometimes, these will happen even within a few minutes. When this happens, I would randomly press keys on the keyboard and all of a sudden it works again.

Anything I am doing wrong?

The main codes never uses "PAUSE" or "END" keys; it also only uses ToolTip for message displays.

I am using Windows 8.1; sometimes I would notice my keyboard language would switch from English to Chinese. I could not tie that as a possible cause because when this HotKeySet problem happens, I could not switch to desktop to see if the Keyboard is set to Chinese.

Link to comment
Share on other sites

could it be that ctrl+right shift is shifting your keyboardsettings (incidentally that can happen when you touch your keys to quickly and by incident you hit ctrl+shift together)

 

thanks for the suggestion, I look at my codes if i have anything that sends those keys. True enough, somewhere, hidden in the deep dark corner, I have a line that sent shift down!

Thanks!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...