Jump to content

HotKeySet Trouble With Uppercase Letter


 Share

Recommended Posts

hello

i have littile problem hotkeyset is not working with Uppercase CHAR

when i set Lowercase a it works but not with Uppercase

any one have solution plz share it :whistle:

HotKeySet("A", "ShowMessage")
While 1
    Sleep(100)
WEnd
Func ShowMessage()
    MsgBox(4096,"","Uppercase A pressed")
EndFunc
Edited by sim
Link to comment
Share on other sites

Ummm, beerman? In 3.1.1 you are allowed to use a single letter for a hotkey... Example:

HotKeySet("e", "Hey")
While 1
Sleep(2000)
WEnd
Func Hey()
MsgBox(0, "Hey", "Hey")
EndFunc

...

EDIT: And if you look, you didn't even pay attention to his question!

Edited by layer
FootbaG
Link to comment
Share on other sites

U MEAN  we cannt use Simple A  any other way to capture Uppercase CHAR

When i press A must be show Message

<{POST_SNAPBACK}>

Didn't say you couldn't use it, it's just it works with Shift + a not Capslock + a

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Is there a way to check if Caps Lock is on (there probably is somewhere on the forums)? You could use that in your script to determine if a capital or lowercase A was pressed.

Link to comment
Share on other sites

$KeyStates = _GetKeyState()
If $KeyStates[1] Then MsgBox(0, "Key State", "Num Lock is On")
If $KeyStates[2] Then MsgBox(0, "Key State", "Scroll Lock is On")
If $KeyStates[3] Then MsgBox(0, "Key State", "Caps Lock is On")

Func _GetKeyState()
    Const $VK_NUMLOCK = 0x90
    Const $VK_SCROLL = 0x91
    Const $VK_CAPITAL = 0x14
    Local $ret, $a_keystate[4]
    $a_keystate[0] = 3
    $ret = DllCall("user32.dll", "long", "GetKeyState", "long", $VK_NUMLOCK)
    $a_keystate[1] = $ret[0]
    $ret = DllCall("user32.dll", "long", "GetKeyState", "long", $VK_SCROLL)
    $a_keystate[2] = $ret[0]
    $ret = DllCall("user32.dll", "long", "GetKeyState", "long", $VK_CAPITAL)
    $a_keystate[3] = $ret[0]
    Return $a_keystate
EndFunc  ;==>_GetKeyState

If _GetNumLock() Then MsgBox(0, "Key State", "Num Lock is On")
If _GetScrollLock() Then MsgBox(0, "Key State", "Scroll Lock is On")
If _GetCaps() Then MsgBox(0, "Key State", "Caps Lock is On")

Func _GetNumLock()
    Const $VK_NUMLOCK = 0x90
    Local $ret
    $ret = DllCall("user32.dll","long","GetKeyState","long",$VK_NUMLOCK)
    Return $ret[0]
EndFunc

Func _GetScrollLock()
    Const $VK_SCROLL = 0x91
    Local $ret
    $ret = DllCall("user32.dll","long","GetKeyState","long",$VK_SCROLL)
    Return $ret[0]
EndFunc

Func _GetCaps()
    Const $VK_CAPITAL = 0x14
    Local $ret
    $ret = DllCall("user32.dll","long","GetKeyState","long",$VK_CAPITAL)
    Return $ret[0]
EndFunc

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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...