Jump to content

Hotkeys and modifier keys


Recommended Posts

I have noticed that if I have say, "E" set as a hotkey and I have the hotkey function spit back the key:

Func FunctionE
  HotKeySet("E")
  Send("E")
  HotKeySet("E", "FunctionE")
EndFunc

Then if I go to hold down shift to type "HELLO" then instead I get "HEllo". How can I avoid this?

Also, is there a way to detect if a modifier key is being held down at any given time?

Link to comment
Share on other sites

#include <GUIConstants.au3>
#include <misc.au3>
$Form1 = GUICreate("AForm1", 250, 65, 193, 115)
$Label1 = GUICtrlCreateLabel("ALabel1", 112, 24, 200)
GUISetState(@SW_SHOW)

While 1
    While (_IsPressed('5B'))
                sleep(100)
        GUICtrlSetData($Label1, "Left Windows Key is being held down...")
    WEnd
    GUICtrlSetData($Label1, "Left Windows Key is not being held down!")
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

There's an example of checking if a modifier key was pressed/held down..

Check the help file for: _IsPressed()

Edited by CHRIS95219
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...