Very Elementary Mouse Button Remapping - What Am I Missing? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
dox
Posts: 11
Joined: 03 Apr 2017, 12:23

Very Elementary Mouse Button Remapping - What Am I Missing?

Post by dox » 24 Sep 2022, 15:30

Below works as expected, with pressing F1 popping intended message.

Code: Select all

F1::F2

F2::
	MsgBox, F2 pressed
Return

But replacing it with RButton or MButton doesn't work.

Code: Select all

F1::Rbutton

Rbutton::
	MsgBox, Right mouse button pressed
Return

Enabling "MouseHook" makes no difference. Must be something elementary I am missing.

Thanks in advance for any explanation! And possible workarounds?

dox
Posts: 11
Joined: 03 Apr 2017, 12:23

Re: Very Elementary Mouse Button Remapping - What Am I Missing?

Post by dox » 24 Sep 2022, 16:53

The tutorial code below, straight from https://www.autohotkey.com/docs/commands/_InputLevel.htm#ExBasic:

Code: Select all

#InputLevel 1
Numpad0::LButton
#InputLevel 0
; This hotkey can be triggered by both Numpad0 and LButton:
~LButton::MsgBox Clicked
is not working for me, either.

I gotta be missing something simple here. Anyone with any ideas what it could be? Some implied directive I didn't declare? Thanks in advance!

gregster
Posts: 9000
Joined: 30 Sep 2013, 06:48

Re: Very Elementary Mouse Button Remapping - What Am I Missing?  Topic is solved

Post by gregster » 24 Sep 2022, 17:53

dox wrote:
24 Sep 2022, 16:53

Code: Select all

#InputLevel 1
Numpad0::LButton
#InputLevel 0
; This hotkey can be triggered by both Numpad0 and LButton:
~LButton::MsgBox Clicked
is not working for me, either.
Works fine here.

But, like always, the permissions level of the script has to fit the one of the target application. See https://www.autohotkey.com/docs/FAQ.htm#uac

User avatar
flyingDman
Posts: 2817
Joined: 29 Sep 2013, 19:01

Re: Very Elementary Mouse Button Remapping - What Am I Missing?

Post by flyingDman » 24 Sep 2022, 18:03

The code in OP's first post also works for me.
14.3 & 1.3.7

dox
Posts: 11
Joined: 03 Apr 2017, 12:23

Re: Very Elementary Mouse Button Remapping - What Am I Missing?

Post by dox » 24 Sep 2022, 19:49

Thanks very much to you both for double-checking! Turns out you are 100% right, Gregster. It is a Win 10 UAC thing that completely eluded me until you brought it to my attention.

Running the hotkey remapping as Admin was without a hitch.

My conundrum is that I intend to invoke these hotkeys both at work and outside, portably out of necessity at work. Any potential workaround other than avoiding them in the first place, while accepting that I am subject to the constraints of UAC while not being able to bypass it with the "Run with UI Access" option?

Thanks again in advance for any ideas.

dox
Posts: 11
Joined: 03 Apr 2017, 12:23

Re: Very Elementary Mouse Button Remapping - What Am I Missing?

Post by dox » 24 Sep 2022, 21:00

Found a workaround under constraint of UAC while satisfying the requirement of portability:

Code: Select all

F1::
	Gosub ~Rbutton
Return


~Rbutton::
	MsgBox, Right button clicked
Return
Straight out of Hotkey Tips and Remarks

Thanks everyone.

Post Reply

Return to “Ask for Help (v1)”