Jump to content

need help with key press


Recommended Posts

hi,

i would like to have a script, that disable a specific (not all) key while another key is pressed.

eg.

if key A is pressed then

disable key B

end if

thanks alot. :(

<{POST_SNAPBACK}>

This blockes the "b" key if the "a" key is used before the "b" key. The only thing is that it blockes the key until the script is closed. I hope this helps.

While 1
    Select
        Case _IsPressed(41); 41 is the hexkey for the letter "A" 
            HotKeySet("b","_blockB"); If a key is set as a hotkey
        ;then the key only does the function it is set to.
    EndSelect
WEnd

Func _IsPressed($hexKey)
Local $aR, $bRv
$hexKey = '0x' & $hexKey
$aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)

If $aR[0] <> 0 Then
    $bRv = 1
Else
    $bRv = 0
EndIf

Return $bRv
EndFunc  
Func _BlockB(); a funtion that does nothing, just used for the hotkey.
EndFunc
Edited by quick_sliver007

.

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