[SCRIPT] Rebind LWin to APPSKEY with win shortcut pass through

Post your working scripts, libraries and tools
Posts: 1
Joined: 24 Feb 2019, 06:38

[SCRIPT] Rebind LWin to APPSKEY with win shortcut pass through

24 Feb 2019, 06:50

As a lot of person I like my Windows key to the right and tend to disable my left Windows and my new razer keyborad does allow any remap but the windows key so I decided to take action.
Here's a script to disable left windows and replace APPSKEY (between fn and right CTRL) by right windows key and allow usage of windows shortcut like Win+R or Win+D or Win+P(I'm a bit surprised this one works as well):

Code: Select all


;bind Left Windows to a function that does nothing
Hotkey, LWin, Blank, On

;bind APPSKEY to function waitForShortcut


	input_var   := 
	end_keyword  = EndKey:
	max_keyword  = Max
	;wait 200ms (T0.2) if you want to type a shortcut such as Win+R or Win+D it only accept one caracter (L1) match endkey to get non visible carater in this case left right up down
	Input, input_var, L1 T0.2 E,{Left}{Right}{Up}{Down}
	;if ErrorLevel contains Endkey it means that shortcut use is using non vsibile caracter and the value need to be recover.
	If ( InStr(ErrorLevel , end_keyword )){
		;recover value of the actual typed key
		StringTrimLeft, input_var, ErrorLevel, StrLen(end_keyword) 
	;if you type one something send RWin plus this key else send a simple RWin
	if(input_var = "l"){
	}else if ( input_var <> "" ){
		send {RWin down}{%input_var%}{RWin up}
		send {RWin}
I've found a lot of help on the forum and a lot of people looking for such a script. I hope this will be able to help some persons.
I'll be glad if you have any suggestion I never did something like that with Autohotkey.

[Edit 1:]
Add check on Win+L to call LockWorkstation as it's a reserve keybind on Windows.
[Edit 2:]
Add support for Win+Arrow shortcut as it wasn't supported with the previous version.
User avatar
Posts: 138
Joined: 12 Jan 2016, 15:46

Re: [SCRIPT] Rebind LWin to APPSKEY with win shortcut pass through

18 Mar 2019, 20:32

Congratulations on your first script! This could be useful for people in a similar situation.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Zatheos and 53 guests