Jump to content

Left Mouse Problem


Recommended Posts

Hi,

first THX for this great tool!

But:

Ich got an problem with my left mouse button. 02 For the right Mouse works well, but 01 works only in Windows not in Applications. Can u help me?

Here´s the Code:

If (_IsPressed('01') = 1) Then

;msgBox(4096, "Test", "Works")

FireBurst()

EndIf

Func _IsPressed($hexKey)

; $hexKey must be the value of one of the keys.

; _IsPressed will return 0 if the key is not pressed, 1 if it is.

; $hexKey should entered as a string, don't forget the quotes!

; (yeah, layer. This is for you)

Local $aR, $bO

$hexKey = '0x' & $hexKey

$aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)

If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then

$bO = 1

Else

$bO = 0

EndIf

Return $bO

EndFunc

Link to comment
Share on other sites

Hi,

first THX for this great tool!

But:

Ich got an problem with my left mouse button. 02 For the right Mouse works well, but 01 works only in Windows not in Applications. Can u help me?

Here´s the Code:

If (_IsPressed('01') = 1) Then

;msgBox(4096, "Test", "Works")

FireBurst()

EndIf

Func _IsPressed($hexKey)

; $hexKey must be the value of one of the keys.

; _IsPressed will return 0 if the key is not pressed, 1 if it is.

; $hexKey should entered as a string, don't forget the quotes!

; (yeah, layer. This is for you)

Local $aR, $bO

$hexKey = '0x' & $hexKey

$aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)

If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then

$bO = 1

Else

$bO = 0

EndIf

Return $bO

EndFunc

You can pass hex numbers directly by using the 0x prefix. Then _IsPressed(0x0A) would need no conversion or checking, for example. With numbers less than decimal ten, there is no difference anyway, so you could just pass _IsPressed(1) or _IsPressed(2) with no quotes. I haven't learned much yet about making DLL calls from AutoIt, but if your call to GetAsyncKeyState in user32.dll expects an integer at $hexKey, it is instead getting the ascii string for "0x01". If that is a problem you could do it this way:

If _IsPressed(0x01) Then FireBurst()

Func _IsPressed($hexKey)
    ; $hexKey must be the hex value of one of the keys.
    ; _IsPressed will return 0 if the key is not pressed, 1 if it is.
    
    Local $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
    If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc

:D

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...