Modifiers Only as Hotkeys Without Losing Them Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
WalterRoberts
Posts: 38
Joined: 25 Feb 2020, 20:00

Modifiers Only as Hotkeys Without Losing Them

07 May 2020, 16:08

I have substituted the actual commands with a msgbox for the folks who are not using virtual desktops.

Code: Select all

`::reload

~#LCtrl::
KeyWait LCtrl
Msgbox Switch to Left Desktop ;Send ^#{Left}
Return

~#LAlt::
KeyWait LAlt
Msgbox Switch to Right Desktop  ;Send ^#{Right}
Return

Everything is working as expected, but I am having the following problem I would like to understand:
When pressing LWin+LCtrl+D (in this exact order) a new virtual desktop is created, but since LWin+LCtrl is part of this native Windows command, when releasing the LCtrl key I get sent back to the left virtual desktop just after creating a new one.
This does not happen when pressing LCtrl+LWin+D. I am really curios if it is possible to still be able to start with LWin without executing "Switch to Left Desktop".
GEV
Posts: 844
Joined: 25 Feb 2014, 00:50

Re: Modifiers Only as Hotkeys Without Losing Them  Topic is solved

07 May 2020, 16:48

Code: Select all

~<#LCtrl::
	KeyWait LCtrl
	If (A_PriorKey = "LControl")
		Msgbox Switch to Left Desktop ;Send ^#{Left}
Return

~<#LAlt::
	KeyWait LAlt
	If (A_PriorKey = "LAlt")
		Msgbox Switch to Right Desktop  ;Send ^#{Right}
Return
WalterRoberts
Posts: 38
Joined: 25 Feb 2020, 20:00

Re: Modifiers Only as Hotkeys Without Losing Them

07 May 2020, 18:10

Very well done! I was looking exactly for a solution like this one: a little modification which does the trick and is still easy to follow. Thank you! This is going to open tremendous potential for more Modifier-Only Hotkeys without having to sacrifice the modifier itself.

Return to “Ask For Help”

Who is online

Users browsing this forum: moowee, nik2502 and 55 guests