Jump to content

_IsPressed and Qoutes, Colins, Braces


AniperLeo
 Share

Recommended Posts

Can _IsPressed detect the ~ ` [ { ] } | : ; " ' , < . > keys?

I did not see this question answered when I searched the forum and I'm a little perplexed as to why no one has asked. I'm trying to write a program that teaches users the shortcut functions of a program and what they do, but I can't figure out how to detect those key-presses listed above, and it is not in the manual. I am running the latest beta of autoit that I know of.

Link to comment
Share on other sites

I don't know where are you from. I'm from germany and on german keyboard you have not a seperat key for every sign you named. I think it's in other languages too. :P

So is "/" and "{" on key "7". "~" and "*" are one key "+". And so can _IsPressed() detect all keys. :)

Best Regards BugFix  

Link to comment
Share on other sites

$dll = DllOpen("user32.dll")
While _IsPressedMod($dll) ; clear buffer
WEnd

While 1
    Sleep(250)
    $typed = _IsPressedMod($dll)
    If $typed Then ExitLoop
WEnd
DllClose($dll)

ConsoleWrite($typed & @LF)

; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/WindowsUserInterface/UserInput/VirtualKeyCodes.asp
Func _IsPressedMod($dll = "user32.dll")
    Local $aR, $bRv, $hexKey, $i
    For $i = 1 To 256
        $hexKey = '0x' & Hex($i, 2)
        $aR = DllCall($dll, "int", "GetAsyncKeyState", "int", $hexKey)
        If $aR[0] <> 0 Then Return Hex($i,2)
    Next
    Return 0
EndFunc   ;==>_IsPressedMod

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