Jump to content

Recommended Posts

Posted

I believe the typical way to handle this is to "unbind" the hotkey at the start of your function and then enable it again at the bottom --

HotKeySet('{RIGHT}', 'test')

Func test()
      HotKeySet('{RIGHT}')
      If WinActive('[CLASS:MSPaintApp]') Then
        MsgBox(0, 'Hotkey Pressed', 'RightArrow')
      Else
        Send('{RIGHT}')
      EndIf
      HotKeySet('{RIGHT}', 'test')
EndFunc

 

Posted (edited)
1 hour ago, Danp2 said:

I believe the typical way to handle this is to "unbind" the hotkey at the start of your function and then enable it again at the bottom

it obvious from the document but didn't know what it meant. it still a mystery to me, so how does it work?

so, initial {Esc} key pressed call captureEsc(), then  unregister/unbind {Esc} key event then able to send {Esc} as 'raw' key, and why set HotKeySet("{Esc}", "captureEsc") inside the function?

; capture and pass along a keypress
HotKeySet("{Esc}", "captureEsc")
Func captureEsc()
    ; ... can do stuff here
    HotKeySet("{Esc}")
    Send("{Esc}")
    HotKeySet("{Esc}", "captureEsc")
EndFunc

 

Edited by zeenmakr

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
  • Recently Browsing   0 members

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