Logitech mouse didn't work at GetKeyState

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
hyaray
Posts: 85
Joined: 20 Jun 2015, 01:37
Contact:

Logitech mouse didn't work at GetKeyState

Post by hyaray » 08 Jan 2022, 11:31

Logitech mouse has a bug??
the codes below can trigger, but GetKeyState is always 0
What's wrong with it. :headwall: :headwall:

I use other mouse, result is 1

Code: Select all

MButton::tooltip,% A_ThisHotkey . "`n" . GetKeyState("MButton", "P")
XButton1::tooltip,% A_ThisHotkey . "`n" . GetKeyState("MButton", "P")
XButton2::tooltip,% A_ThisHotkey . "`n" . GetKeyState("MButton", "P")
Last edited by hyaray on 09 Jan 2022, 08:54, edited 1 time in total.

User avatar
mikeyww
Posts: 26939
Joined: 09 Sep 2014, 18:38

Re: Logitech mouse didn't work at GetKeyState

Post by mikeyww » 08 Jan 2022, 12:44

When I fixed the v1 syntax errors, it worked for me. MButton key state is 1 in the MButton hotkey.

User avatar
hyaray
Posts: 85
Joined: 20 Jun 2015, 01:37
Contact:

Re: Logitech mouse didn't work at GetKeyState

Post by hyaray » 09 Jan 2022, 06:49

mikeyww wrote:
08 Jan 2022, 12:44
fixed the v1 syntax errors
I don't understand what it means. It should be Logitech's problem.
Other mouse is worked.
Thanks for help!!

User avatar
boiler
Posts: 16960
Joined: 21 Dec 2014, 02:44

Re: Logitech mouse didn't work at GetKeyState

Post by boiler » 09 Jan 2022, 06:58

hyaray wrote:
09 Jan 2022, 06:49
mikeyww wrote:
08 Jan 2022, 12:44
fixed the v1 syntax errors
I don't understand what it means.
He is saying he changed the code so it would work with AHK v1 because you posted in the v1 section of the forum, and when he did that, the code worked. If your code worked (at least didn’t produce an error for an unknown function) as shown, you are either running AHK v2, or you included a ToolTip() function that you didn’t show in your post. AHK v1 only has a command version of ToolTip, not a function.

If you are using AHK v2, you should post in the v2 section of “Ask For Help” or at least state you are using v2 because the latest official release is still v1.

User avatar
mikeyww
Posts: 26939
Joined: 09 Sep 2014, 18:38

Re: Logitech mouse didn't work at GetKeyState

Post by mikeyww » 09 Jan 2022, 07:16

I agree with boiler.

Perhaps one possibility is that the Logitech button that you think is MButton is actually something else.

User avatar
hyaray
Posts: 85
Joined: 20 Jun 2015, 01:37
Contact:

Re: Logitech mouse didn't work at GetKeyState

Post by hyaray » 09 Jan 2022, 08:48

sorry, It's my fault.
I should move it to v2.
I'm using Logitech M720, windows 10 21H1.
if you worked well, I don't know what's the reason :headwall:

User avatar
hyaray
Posts: 85
Joined: 20 Jun 2015, 01:37
Contact:

Re: Logitech mouse didn't work at GetKeyState

Post by hyaray » 09 Jan 2022, 08:56

mikeyww wrote:
09 Jan 2022, 07:16
Perhaps one possibility is that the Logitech button that you think is MButton is actually something else.
LButton and RButton is OK.
not only MButton, but also Xbutton1 and Xbutton2 not worked. :sick:

User avatar
boiler
Posts: 16960
Joined: 21 Dec 2014, 02:44

Re: Logitech mouse didn't work at GetKeyState

Post by boiler » 09 Jan 2022, 08:57

It worked with v2 as written with my Logitech M705 mouse. As mikeyww pointed out before, each of your GetKeyState() functions are looking for MButton. Are you sure you didn't mean the following?

Code: Select all

MButton::tooltip(A_ThisHotkey . "`n" . GetKeyState("MButton", "P"))
XButton1::tooltip(A_ThisHotkey . "`n" . GetKeyState("XButton1", "P"))
XButton2::tooltip(A_ThisHotkey . "`n" . GetKeyState("XButton2", "P"))

If none of the above worked, as you described, maybe you have the Logitech software set up to produce something else when those buttons are pressed. Try disabling that software if you have it running, or set those buttons to just produce their native function.

User avatar
hyaray
Posts: 85
Joined: 20 Jun 2015, 01:37
Contact:

Re: Logitech mouse didn't work at GetKeyState

Post by hyaray » 23 Jan 2022, 19:37

boiler wrote:
09 Jan 2022, 08:57
It worked with v2 as written with my Logitech M705 mouse. As mikeyww pointed out before, each of your GetKeyState() functions are looking for MButton. Are you sure you didn't mean the following?

Code: Select all

MButton::tooltip(A_ThisHotkey . "`n" . GetKeyState("MButton", "P"))
XButton1::tooltip(A_ThisHotkey . "`n" . GetKeyState("XButton1", "P"))
XButton2::tooltip(A_ThisHotkey . "`n" . GetKeyState("XButton2", "P"))
If none of the above worked, as you described, maybe you have the Logitech software set up to produce something else when those buttons are pressed. Try disabling that software if you have it running, or set those buttons to just produce their native function.
ProcessClose 3 logi*.exe,then worked well... :bravo:
I will not run then at all.

Post Reply

Return to “Ask for Help (v1)”