Make AHK press Mouse6?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AaronR
Posts: 1
Joined: 27 Feb 2017, 09:54

Make AHK press Mouse6?

27 Feb 2017, 09:58

Is there a way to remap something such as spacebar, Shift, B or \ to make Autohotkey press mouse6? I haven't seen any documentation about it supporting Mouse6 but I'm hoping there is and it's just unwidely used.
Thanks.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Make AHK press Mouse6?

27 Feb 2017, 10:46

Mouse6 doesn't really exist in windows. All extra buttons beyond 5 (XButton2) are probably handled by your mouse software. You can view the the KeyHistory to see if pressing mouse6 generates something useful.

Good luck.
User avatar
aztec3
Posts: 177
Joined: 07 Apr 2014, 12:05

Re: Make AHK press Mouse6?

27 Feb 2017, 10:47

Sorry, per the documentation, there is a Mouse4 and Mouse5, but no Mouse6.

Your best chance is to try this:

https://autohotkey.com/docs/KeyList.htm#SpecialKeys

Special Keys

If your keyboard or mouse has a key not listed above, you might still be able to make it a hotkey by using the following steps:

Ensure that at least one script is running that is using the keyboard hook. You can tell if a script has the keyboard hook by opening its main window and selecting "View->Key history" from the menu bar.

Double-click that script's tray icon to open its main window.

Press one of the "mystery keys" on your keyboard.

Select the menu item "View->Key history"

Scroll down to the bottom of the page. Somewhere near the bottom are the key-down and key-up events for your key. NOTE: Some keys do not generate events and thus will not be visible here. If this is the case, you cannot directly make that particular key a hotkey because your keyboard driver or hardware handles it at a level too low for AutoHotkey to access. For possible solutions, see further below.

If your key is detectible, make a note of the 3-digit hexadecimal value in the second column of the list (e.g. 159).

To define this key as a hotkey, follow this example:
SC159:: ; Replace 159 with your key's value.
MsgBox, %A_ThisHotKey% was pressed.
return

Reverse direction: To remap some other key to become a "mystery key", follow this example:

; Replace 159 with the value discovered above. Replace FF (if needed) with the
; key's virtual key, which can be discovered in the first column of the Key History screen.
#c::Send {vkFFsc159}

Alternate solutions: If your key or mouse button is not detectible by the Key History screen, one of the following might help:

Reconfigure the software that came with your mouse or keyboard (sometimes accessible in the Control Panel or Start Menu) to have the "mystery key" send some other keystroke. Such a keystroke can then be defined as a hotkey in a script. For example, if you configure a mystery key to send Control+F1, you can then indirectly make that key as a hotkey by using ^F1:: in a script.

Try AHKHID. You can also try searching the forum for a keywords like RawInput*, USB HID or AHKHID.

The following is a last resort and generally should be attempted only in desperation. This is because the chance of success is low and it may cause unwanted side-effects that are difficult to undo:

Disable or remove any extra software that came with your keyboard or mouse or change its driver to a more standard one such as the one built into the OS. This assumes there is such a driver for your particular keyboard or mouse and that you can live without the features provided by its custom driver and software.
User avatar
evilC
Posts: 4824
Joined: 27 Feb 2014, 12:30

Re: Make AHK press Mouse6?

27 Feb 2017, 14:42

He says he wants to SEND Mouse6, not LISTEN for mouse6

Even if you could send (The nonexistent) Mouse6, nothing would recognize and react to it.
What has made you think that you WANT to send mouse6?
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: Make AHK press Mouse6?

28 Feb 2017, 02:55

evilC wrote:He says he wants to SEND Mouse6, not LISTEN for mouse6
The first step of sending any mystery key is determining what its key code is, which one does by "listening" first. The documentation shows how to do that, and then how to send the key, as you might know if you had read it.

Of course, your other point is a good one.
bigdeal
Posts: 66
Joined: 13 Feb 2017, 06:31

Re: Make AHK press Mouse6?

28 Feb 2017, 08:34

evilC wrote:He says he wants to SEND Mouse6, not LISTEN for mouse6
first listen than kill... uhm i mean send
User avatar
evilC
Posts: 4824
Joined: 27 Feb 2014, 12:30

Re: Make AHK press Mouse6?

28 Feb 2017, 12:04

OK, so what you really mean is that you want to send whichever button you have mapped to the 6th button on your mouse?
Surely if your mouse has a 6th button, it must come with software to bind that non-standard mouse button to something recognized by windows?

Can you not just use that software to set MB6 to something else (eg F24), then use AHK to remap F24 to what you actually want?
I have never seen a mouse with more than 5 buttons, but which does not come with remapping software, but I guess they may exist.
User avatar
aztec3
Posts: 177
Joined: 07 Apr 2014, 12:05

Re: Make AHK press Mouse6?

28 Feb 2017, 12:29

evilC,
yup, that is part of the referenced documentation:

"Reconfigure the software that came with your mouse or keyboard (sometimes accessible in the Control Panel or Start Menu) to have the "mystery key" send some other keystroke. Such a keystroke can then be defined as a hotkey in a script. For example, if you configure a mystery key to send Control+F1, you can then indirectly make that key as a hotkey by using ^F1:: in a script."
User avatar
evilC
Posts: 4824
Joined: 27 Feb 2014, 12:30

Re: Make AHK press Mouse6?

28 Feb 2017, 14:55

FYI, extra buttons on mice do not always have a virtual key code when unbound.

For example, on my Logitech G700s (A 15-odd button gaming mouse), if I unbind all extra buttons in LGS (Logitech Gaming Software), then ONLY the default button mappings (LMB, RMB, MMB, XB1, XB2 etc) do anything - the other six buttons which have no normal mappings do not show up AT ALL when viewing Key History

However, on my Logitech MX Revolution (A non-gaming mouse with 1 "extra" button), if I unbind the one non-standard button in Logitech SetPoint (Or even uninstall the driver), then the one extra button reports as the default (VKAA - AKA VK_BROWSER_SEARCH) when viewed in Key History.

So, as you can see, behavior is not always consistent, even with mice from the same manufacturer.
User avatar
aztec3
Posts: 177
Joined: 07 Apr 2014, 12:05

Re: Make AHK press Mouse6?

28 Feb 2017, 15:02

evilC,
yes, you are correct again, per the documentation:

Alternate solutions: If your key or mouse button is not detectible (sic) by the Key History screen, one of the following might help:
User avatar
evilC
Posts: 4824
Joined: 27 Feb 2014, 12:30

Re: Make AHK press Mouse6?

28 Feb 2017, 15:08

To be fair to the OP, the documentation doesn't really explain the reasons behind it, which answers on this thread have attempted to clarify.
I guess from a manufacturer's point of view, if you only have 1 or 2 extra buttons on a mouse, then defaulting them to useful VKs makes some sense.
If you have a load of extra buttons, printing or moulding in icons or words for these VKs onto the buttons of a programmable mouse is kind of pointless.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: JKJadan and 264 guests