Remaped mouse wheels have no reaction when #InputLevel was set to 1

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AmGn

Remaped mouse wheels have no reaction when #InputLevel was set to 1

24 Nov 2017, 02:35

Recently I brought a Logitech mouse which contains two side keys as XButton 1/2 and a two axis wheel which act as WheelLeft and WheelRight actions when click the wheel to left and right. However, my previous mouse act the left and right wheel direction as XButton 1/2, I tried to use Logitech Options to change their functions, but this software is stupid and sometimes doesn't react the clicks, so I use AHK to remap the keys.

Code: Select all

; For the side keys as XButton 1/2, I remap them to LButton and RButton with two lines of code:
XButton1::RButton
XButton2::LButton

; For WheelLeft/Right, I remap them to XButton 1/2 to make this act as the behavior of my previous mouse:
WheelLeft::Send {XButton1}
WheelRight::Send {XButton2}
I have to use `Send {...}` because the WheelLeft/Right only have "Down" action, if I remap them directly, the XButtons will not be released after they are pressed.

Then the problem comes, I have wrote another script for my previous mouse that have actions like:

Code: Select all

; For my previous mouse, the XButtons is the Left and Right of the wheel
XButton1::Enter
XButton2::
; (do something...)
Return
But the old script ignored the simulated XButtons from the Remap script as the #InputLevel is 0, so I add #InputLevel 1 before the Remap code:

Code: Select all

#InputLevel 1
XButton1::RButton
XButton2::LButton
WheelLeft::Send {XButton1}
WheelRight::Send {XButton2}
Then the XButtons to R/L Buttons works as Artificial keys for the old script and works well, but the WheelL/R to XButtons totally have no actions! They appeared in the log of the Remap script:
021: Send,{XButton1} (0.09)
021: Return (0.95)
022: Send,{XButton2} (0.05)
022: Return (1.66)
But in the key log of the old script, they disappered! Also, they seems totally be blocked as they are not working in other programs, neither as XButtons, nor as WheelL/R.

If I add #InputLevel 0 before the last two lines, the WheelL/R to XButton1/2 remap works but they are ignored by other scripts.

So is there any way to both increase their #InputLevel and make them works? Or is there any way to make other scripts response #InputLevel 0 keys?
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: Remaped mouse wheels have no reaction when #InputLevel was set to 1

24 Nov 2017, 07:10

You're mentioning the key log but posting the last lines log. Have those key events disappeared from the old script key log?

The main thing you need to take into consideration when using two scripts using hooks (which mouse hotkeys always do), is that the most recently (re)started/unsuspended or highest elevated script processes the hook first. So you'll want to start your remapping script last (or as admin and the other script as user), otherwise the remapping is performed after the old script check for its trigger.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333, Google [Bot] and 367 guests