Can't get a simple SendInput script to work Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
User avatar
ManualColdkey
Posts: 5
Joined: 22 Apr 2024, 04:04

Can't get a simple SendInput script to work

30 Apr 2024, 03:41

I use this script to change from the taskbar between layers of X-Mouse control, to change what my mouse's buttons do. I had setup a hotkey (Crtl Shift + ù) to make the switch. Later i decide to change it because I needed that combination for other pourposes. I decided to use AltGr + Numbpad3.
The old code works:

Code: Select all

#Requires AutoHotkey v2.0
SendInput(">^+{ù}")
Return


But this new one does not:

Code: Select all

#Requires AutoHotkey v2.0
SendInput("<^>!{Numpad3}")
Return
I read the documentation but I don't get why it does not work. It seems to me that it should work just the same.
Where is my mistake?

(I'm sorry if this sounds like a stupid question, but I've been working on this for a while with no luck. At least I hope the answer will not be too much trouble)
gregster
Posts: 9075
Joined: 30 Sep 2013, 06:48

Re: Can't get a simple SendInput script to work  Topic is solved

30 Apr 2024, 05:15

Try

Code: Select all

SendInput("^!{Numpad3}")
Afaik, < and > are only supported in hotkey definitions (left side of the ::), not with Send and its variants. At least, they won't do what you seem to expect - they will send a literal character, though (which might or might not interfere with what you are doing).

The above seems to work for AltGr without specifying left and right variants. Alternatively, this should work as well:

Code: Select all

SendInput("{LCtrl down}{RAlt down}{Numpad3}{LCtrl up}{RAlt up}")
User avatar
ManualColdkey
Posts: 5
Joined: 22 Apr 2024, 04:04

Re: Can't get a simple SendInput script to work

30 Apr 2024, 13:19

It works, thank you for your answer @gregster!

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: BlueHornet and 99 guests