Order of pressing modifier keys affects the result

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: Order of pressing modifier keys affects the result

16 Jan 2019, 12:34

Any reason you're using custom combination hotkeys for modifier keys instead of the conventional way?

Code: Select all

<#Right::Send {End}
<#+Right::Send +{End}
victorv
Posts: 26
Joined: 31 Dec 2018, 09:13

Re: Order of pressing modifier keys affects the result

18 Jan 2019, 04:01

Nextron wrote:
16 Jan 2019, 12:34
Any reason you're using custom combination hotkeys for modifier keys instead of the conventional way?

Code: Select all

<#Right::Send {End}
<#+Right::Send +{End}
No particular reason. I am a novice and that way seemed to me more explicit. Is there a difference?
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: Order of pressing modifier keys affects the result

18 Jan 2019, 12:33

This explains it pretty well:https://autohotkey.com/docs/Hotkeys.htm#combo
So for Control, Shift, Alt or Windows, I'd stick with ^, +, ! and #.
victorv
Posts: 26
Joined: 31 Dec 2018, 09:13

Re: Order of pressing modifier keys affects the result

19 Jan 2019, 02:56

Nextron wrote:
18 Jan 2019, 12:33
This explains it pretty well:https://autohotkey.com/docs/Hotkeys.htm#combo
So for Control, Shift, Alt or Windows, I'd stick with ^, +, ! and #.
I tried it both ways -- the behavior in my case is the same. My problem now is that after I press LWin&Shift&Right, the text is selected till the end of the line, but then Start menu is opened. :(
User avatar
Nextron
Posts: 1391
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win10 AHK: Unicode x32

Re: Order of pressing modifier keys affects the result

19 Jan 2019, 07:52

After you used the hotkey, go to AHK's key history and copy/paste the output here.
victorv
Posts: 26
Joined: 31 Dec 2018, 09:13

Re: Order of pressing modifier keys affects the result

21 Jan 2019, 12:34

Code: Select all

VK  SC	Type	Up/Dn	Elapsed	Key		Window
-------------------------------------------------------------------------------------------------------------
24  147	 	d	10.06	Home           	... - PyCharm
24  147	 	u	0.08	Home           	
5B  15B	 	d	0.94	LWin           	
A0  02A	 	d	0.14	LShift         	
27  14D	h	d	0.16	Right          	
A0  02A	i	d	0.00	LShift         	
5B  15B	i	u	0.05	LWin           	
23  14F	i	d	0.00	End            	
23  14F	i	u	0.00	End            	
A0  02A	i	u	0.02	LShift         	
5B  15B	i	d	0.01	LWin           	
A0  02A	i	d	0.00	LShift         	
27  14D	s	u	0.00	Right          	
A0  02A	 	u	0.17	LShift         	
5B  15B	h	u	0.03	LWin           	Search
victorv
Posts: 26
Joined: 31 Dec 2018, 09:13

Re: Order of pressing modifier keys affects the result

21 Jan 2019, 12:36

BTW, how I set up this site to send me email notifications about new replies?
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Order of pressing modifier keys affects the result

25 Jan 2019, 14:39

One more shot based on Nextron's proposition:

Code: Select all

<#+Right::
	Send, +{End}
	Send, {Esc Up} ; try Send {Esc} too, but is more likely to have side effect
return
but based on history output try also:

Code: Select all

<#+Right::
	Send, {LWin Down}
	Send +{End}
	Send, {LWin Up}
return
Edit: KeyWait removed
victorv
Posts: 26
Joined: 31 Dec 2018, 09:13

Re: Order of pressing modifier keys affects the result

28 Jan 2019, 04:14

Code: Select all

<#+Right::
	Send, +{End}
	Send, {Esc Up}
Return

VK  SC	Type	Up/Dn	Elapsed	Key		Window
-------------------------------------------------------------------------------------------------------------
5B  15B	 	d	3.83	LWin           	shortcuts.ahk - SciTE4AutoHotkey
A0  02A	 	d	0.17	LShift         	
27  14D	h	d	0.14	Right          	
5B  15B	i	u	0.00	LWin           	
23  14F	i	d	0.00	End            	
23  14F	i	u	0.01	End            	
5B  15B	i	d	0.02	LWin           	
5B  15B	i	u	0.00	LWin           	
A0  02A	i	u	0.00	LShift         	
1B  001	i	u	0.01	Escape         	
5B  15B	i	d	0.02	LWin           	Search
A0  02A	i	d	0.00	LShift         	
27  14D	s	u	0.06	Right          	
A0  02A	 	u	0.13	LShift         	
5B  15B	h	u	0.03	LWin           	shortcuts.ahk - SciTE4AutoHotkey
This version works (start menu appears then closes -- not ideal but at least something).
Version with simple `Esc` doesn't close the start menu.
The second version doesn't work (start menu opens as in other cases).
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Order of pressing modifier keys affects the result

28 Jan 2019, 06:53

Next shot:

Code: Select all

<#+Right::Send, +{End}{Shift up}{Esc Up}
This should execute faster! Or:

Code: Select all

<#+Right::Send, {Shift down}{End}{Shift up}{Esc Up}
Try to switch last two key commands and try without Shift command/s once again.

Try to set Repeat delay to longer & Repeat rate to slower @ Keyboard Properties.
Control Panel > All Control Panel Items > Keyboard
Attachments
Keyboard_settings.png
Keyboard_settings.png (17.4 KiB) Viewed 5156 times
victorv
Posts: 26
Joined: 31 Dec 2018, 09:13

Re: Order of pressing modifier keys affects the result

29 Jan 2019, 13:13

Nothing of this fixes appearing of start menu.
It's too much to write to each attempt how it behaves.
https://stackoverflow.com/questions/50454872/using-autohotkey-on-windows-10-allows-window-key-to-open-start-menu -- a similar problem. Looks it's smth with Windows internals.
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Order of pressing modifier keys affects the result

29 Jan 2019, 17:30

Interesting Info, you found!
Regardless, this seems promising to me:

Code: Select all

<#+Right::Send, +{End}{Esc up} ; if works try without {Esc up} in this line
LWin up::Send, {Esc up}
But reading your link:

Code: Select all

<#+Right::
	Send, +{End}{Ctrl down}
	KeyWait, LWin
	Send, {Ctrl up}
return
Or link in the link:

Code: Select all

#MenuMaskKey vk07  ; vk07 is unassigned.
#UseHook
<#+Right::
	Send, +{End}
	KeyWait LWin
return
This should work according to Docs:

Code: Select all

<#+Right::Send, +{End}
~LWin::Send {Blind}{vk07}
P.s.: Occasionally you have to try different combinations of mentioned approaches. If you find working code please report!
victorv
Posts: 26
Joined: 31 Dec 2018, 09:13

Re: Order of pressing modifier keys affects the result

30 Jan 2019, 02:39

Code: Select all

<#+Right::
	Send, +{End}{Ctrl down}
	KeyWait, LWin
	Send, {Ctrl up}
return
This works, but not always: sometimes flawlessly, sometimes you see start menu flickering, in rare cases the menu doesn't close.

Code: Select all

VK  SC	Type	Up/Dn	Elapsed	Key		Window
-------------------------------------------------------------------------------------------------------------
23  14F	i	d	0.00	End            	
23  14F	i	u	0.00	End            	
A2  01D	i	d	0.02	LControl       	
5B  15B	i	d	0.01	LWin           	
27  14D	s	u	0.06	Right          	
A0  02A	 	u	0.00	LShift         	
5B  15B	h	u	0.05	LWin           	
A2  01D	i	u	0.00	LControl       	
25  14B	 	d	0.28	Left           	
25  14B	 	u	0.11	Left           	
5B  15B	h	d	0.13	LWin           	
07  000	i	d	0.00	not found      	
07  000	i	u	0.00	not found      	
A0  02A	 	d	0.13	LShift         	
27  14D	h	d	0.05	Right          	
5B  15B	i	u	0.00	LWin           	
23  14F	i	d	0.00	End            	
23  14F	i	u	0.00	End            	
A2  01D	i	d	0.02	LControl       	
5B  15B	i	d	0.01	LWin           	
27  14D	s	u	0.06	Right          	
A0  02A	 	u	0.06	LShift         	
5B  15B	h	u	0.02	LWin           	
A2  01D	i	u	0.00	LControl       	
25  14B	 	d	0.28	Left           	
25  14B	 	u	0.11	Left           	
5B  15B	h	d	0.09	LWin           	
07  000	i	d	0.00	not found      	
07  000	i	u	0.00	not found      	
A0  02A	 	d	0.09	LShift         	
27  14D	h	d	0.08	Right          	
5B  15B	i	u	0.00	LWin           	
23  14F	i	d	0.00	End            	
23  14F	i	u	0.00	End            	
A2  01D	i	d	0.03	LControl       	Cortana
5B  15B	i	d	0.01	LWin           	
27  14D	s	u	0.05	Right          	
A0  02A	 	u	0.02	LShift         	
5B  15B	h	u	0.01	LWin           	
A2  01D	i	u	0.00	LControl  
Other versions don't work.
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Order of pressing modifier keys affects the result

30 Jan 2019, 03:37

Just combine it with the best we have thill now:

Code: Select all

<#+Right::
	Send, +{End}{Ctrl down}{Esc up}
	KeyWait, LWin
	Send, {Ctrl up}{Esc up}
return
P.s.: Try to switch Esc & Ctrl keys too.
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Order of pressing modifier keys affects the result

30 Jan 2019, 03:59

One more idea:

Code: Select all

<#+Right::
	Send, +{End}{Ctrl down}{Esc up}
	KeyWait, LWin
	Sleep, 25 ; wait a bit while Ctrl is still down blocking Start Menu 
	Send, {Ctrl up}{Esc up}
	WinClose, ahk_exe SearchUI.exe ; deffinitly closes Start Menu if it was not blocked
return
P.s.: Try without {Esc up} too!
victorv
Posts: 26
Joined: 31 Dec 2018, 09:13

Re: Order of pressing modifier keys affects the result

30 Jan 2019, 05:25

rommmcek wrote:
30 Jan 2019, 03:37
Just combine it with the best we have thill now:

Code: Select all

<#+Right::
	Send, +{End}{Ctrl down}{Esc up}
	KeyWait, LWin
	Send, {Ctrl up}{Esc up}
return
P.s.: Try to switch Esc & Ctrl keys too.
The same behaviour: sometimes works, sometimes not.
victorv
Posts: 26
Joined: 31 Dec 2018, 09:13

Re: Order of pressing modifier keys affects the result

30 Jan 2019, 05:33

This versions works the best:

Code: Select all

<#+Right::
	Send, +{End}{Ctrl down}
	KeyWait, LWin
	Sleep, 25 ; wait a bit while Ctrl is still down blocking Start Menu 
	Send, {Ctrl up}
	WinClose, ahk_exe SearchUI.exe ; deffinitly closes Start Menu if it was not blocked
return

~LWin::Send {Blind}{vk07}

LWin up::return
I am ok to tolerate flickering until we find a better solution.

The only issue is that when I press Shift&WIn Start menu opens.

Code: Select all

VK  SC	Type	Up/Dn	Elapsed	Key		Window
-------------------------------------------------------------------------------------------------------------
5B  15B	h	d	1.88	LWin           	shortcuts.ahk - SciTE4AutoHotkey
07  000	i	d	0.01	not found      	
07  000	i	u	0.00	not found      	
A0  02A	 	d	0.08	LShift         	
27  14D	h	d	0.11	Right          	
5B  15B	i	u	0.00	LWin           	
23  14F	i	d	0.00	End            	
23  14F	i	u	0.00	End            	
A2  01D	i	d	0.01	LControl       	
5B  15B	i	d	0.02	LWin           	
27  14D	s	u	0.06	Right          	
A0  02A	 	u	0.05	LShift         	
5B  15B	h	u	0.05	LWin           	
A2  01D	i	u	0.03	LControl       	
25  14B	 	d	0.61	Left           	
25  14B	 	u	0.09	Left           	
5B  15B	h	d	0.30	LWin           	
07  000	i	d	0.00	not found      	
07  000	i	u	0.00	not found      	
A0  02A	 	d	0.23	LShift         	
27  14D	h	d	0.16	Right          	
5B  15B	i	u	0.00	LWin           	
23  14F	i	d	0.00	End            	
23  14F	i	u	0.00	End            	
A2  01D	i	d	0.02	LControl       	
5B  15B	i	d	0.01	LWin           	
27  14D	s	u	0.06	Right          	
A0  02A	 	u	0.08	LShift         	
5B  15B	h	u	0.03	LWin           	
A2  01D	i	u	0.03	LControl       	
5B  15B	h	d	1.41	LWin           	
07  000	i	d	0.00	not found      	
07  000	i	u	0.00	not found      	
A0  02A	 	d	0.06	LShift         	
5B  15B	h	u	0.14	LWin           	
A0  02A	 	u	0.03	LShift         	Cortana
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Order of pressing modifier keys affects the result

30 Jan 2019, 13:09

It's hard to help you, having no such issues.
I think now Sleep, 25 is useless. (To test use first Seep, 2000 instead then without it)
Here is my new proposal with more "professional" approach. (I'm hardcore amateur!):

Code: Select all

<#+Right::Send, +{End}
~LWin::
~+LWin::Send {Blind}{vk07}
Edit: Fixing blunder!
victorv
Posts: 26
Joined: 31 Dec 2018, 09:13

Re: Order of pressing modifier keys affects the result

30 Jan 2019, 14:12

I rename Cortana app dir so that it would not start. No it's gotten worse -- start menu is opens and doesn't go away.
Not sure it's worth to waste your and my time with this.
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Order of pressing modifier keys affects the result

30 Jan 2019, 14:34

Not loosing much time for a few lines! I'm interesting why this happens.
What about this (if you find time and will):

Code: Select all

<#+Right::Send, +{End}{Ctrl down}
~LWin up::
~+LWin up::Send, {Ctrl up} ; This two hotkeys fire each! time LWin is released, so I think it is right approach.
P.s.: Renaming Win folder is a double blade sword!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], hugojans and 101 guests