Send #r sends r in Windows-Hotkey

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Leli196
Posts: 220
Joined: 29 Aug 2015, 05:47
Location: Germany

Send #r sends r in Windows-Hotkey

Post by Leli196 » 30 Apr 2024, 11:04

I have problems with sending keycombos with windows key in hotkeys that also include the windows key.

Minimal working examples:
#v:: Send, #r
This does send r instead of #r, what am I doing wrong?

#r:: Send, #v
This does not open the clipboard history and does not send v.

Greetings

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

Re: Send #r sends r in Windows-Hotkey

Post by gregster » 30 Apr 2024, 11:15

Both work here with latest v1.
What's the context? When do you press these key combos? Is this the whole code you are running while testing?
I would check the KeyHistory.

Leli196
Posts: 220
Joined: 29 Aug 2015, 05:47
Location: Germany

Re: Send #r sends r in Windows-Hotkey

Post by Leli196 » 30 Apr 2024, 17:06

Yes, to test the problem the examples are literally the only code in the script, to rule out other problems. (It did not work in my main script so I outsourced it.)
Latest v1 as well. Strange.

I will check the KeyHistory tomorrow.

Leli196
Posts: 220
Joined: 29 Aug 2015, 05:47
Location: Germany

Re: Send #r sends r in Windows-Hotkey

Post by Leli196 » 01 May 2024, 09:37

So I looked into the KeyHistory now. It looks like it is a problem related to the difference between LWin and RWin.

@gregster You were probably using LWin, right? Because then it works on my PC as well. But I was testing with RWin and then it does not work.
Can you confirm that you were using LWin and maybe also that RWin does not work for you as well?

AHK seemingly always sends LWin, while the hotkey also reacts on RWin.

RWin:

Code: Select all

5C  15C	 	d	0.03	RWin           	
56  02F	h	d	0.03	v              	
5B  15B	i	d	0.00	LWin           	
11  01D	i	d	0.00	Control        	
11  01D	i	u	0.00	Control        	
5C  15C	i	u	0.00	RWin           	
52  013	i	d	0.00	r              	
52  013	i	u	0.00	r              	
5B  15B	i	u	0.00	LWin           	
11  01D	i	d	0.00	Control        	
5C  15C	i	d	0.00	RWin           	
11  01D	i	u	0.00	Control        	
56  02F	s	u	0.13	v              	
5C  15C	 	u	0.20	RWin           	
A2  01D	i	d	0.00	LControl       	
A2  01D	i	u	0.00	LControl       	
LWin:

Code: Select all

5B  15B	 	d	0.03	LWin           	
56  02F	h	d	0.02	v              	
52  013	i	d	0.00	r              	
52  013	i	u	0.00	r              	
5B  15B	i	u	0.00	LWin           	
11  01D	i	d	0.00	Control        	
5B  15B	i	d	0.00	LWin           	
11  01D	i	u	0.00	Control        	
56  02F	s	u	0.11	v              	Ausführen
5B  15B	 	u	0.03	LWin           	
A2  01D	i	d	0.00	LControl       	
A2  01D	i	u	0.00	LControl       	

Leli196
Posts: 220
Joined: 29 Aug 2015, 05:47
Location: Germany

Re: Send #r sends r in Windows-Hotkey

Post by Leli196 » 02 May 2024, 19:08

Quite buggy. I created a workaround with the following code:

Code: Select all

#v:: SendInput, % "{" (w := (GetKeyState("RWin", "P") ? "RWin" : "LWin")) " down}r{" w " up}"
But shouldn't AHK itself use the correct Win in Send by itself, if the wrong one causes problems?

Post Reply

Return to “Ask for Help (v1)”