AutoHotkey doesn't work on VSCODE

Get help with using AutoHotkey and its commands and hotkeys
yokowasis
Posts: 11
Joined: 02 Apr 2016, 00:17

AutoHotkey doesn't work on VSCODE

Post by yokowasis » 02 Aug 2020, 08:29

I remap some of my button. e.g. Swapping Ctrl and Win button. While it works on most Application, it doesn't work on some. 2 of them are VSCode and Steam.

For example, when in vscode When I Press WIN+P, it should translate into CTRL+P, but instead it doesn't get translated and WIN+P is still fired (Open Projector Settings). The same happen on steam. When I press WIN+A, it should translate into CTRL+A, but instead if doesn't do anything, this happen only on Login box, after Logged in, it works just fine.

I can live with steam, but for some reason VSCode, catch the key even before AHK. Is there any workaround ? Thanks.

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

Re: AutoHotkey doesn't work on VSCODE

Post by gregster » 02 Aug 2020, 15:07

Try to run the script as admin...

yokowasis
Posts: 11
Joined: 02 Apr 2016, 00:17

Re: AutoHotkey doesn't work on VSCODE

Post by yokowasis » 03 Aug 2020, 20:30

gregster wrote:
02 Aug 2020, 15:07
Try to run the script as admin...
Tried it , doesn't work.

Is there a way to make Windowsd Prioritize AHK instead of VSCode ? as of right now VSCode take precedence. The key get send to vscode, and then to AHK. AHK should be on the top of command chain.

User avatar
boiler
Posts: 5604
Joined: 21 Dec 2014, 02:44

Re: AutoHotkey doesn't work on VSCODE

Post by boiler » 03 Aug 2020, 20:54

I use VSCode and the following works for me:

Code: Select all

LWin::LCtrl
LCtrl::LWin
When I press Win+P, it brings up the Quick Open menu, just like it normally would using Ctrl+P. Same for other key combinations involving Ctrl, such as Win+Shift+P to bring up the Command Palette just like Ctrl+Shift+P normally does.

yokowasis
Posts: 11
Joined: 02 Apr 2016, 00:17

Re: AutoHotkey doesn't work on VSCODE

Post by yokowasis » 03 Aug 2020, 21:00

boiler wrote:
03 Aug 2020, 20:54
I use VSCode and the following works for me:

Code: Select all

LWin::LCtrl
LCtrl::LWin
When I press Win+P, it brings up the Quick Open menu, just like it normally would using Ctrl+P. Same for other key combinations involving Ctrl, such as Win+Shift+P to bring up the Command Palette just like Ctrl+Shift+P normally does.
HI. Thanks for trying. Can your try

Code: Select all

#p::Send, ^p
My code doesn't just remap the ctrland win. I map the hotkey / shortcut.
Last edited by yokowasis on 03 Aug 2020, 21:19, edited 1 time in total.

User avatar
boiler
Posts: 5604
Joined: 21 Dec 2014, 02:44

Re: AutoHotkey doesn't work on VSCODE

Post by boiler » 03 Aug 2020, 21:19

yokowasis wrote:
03 Aug 2020, 21:00
Can your try

Code: Select all

#p::Send, ^p
This also works for me. When I press Win+P, it brings up the Quick Open menu.

yokowasis
Posts: 11
Joined: 02 Apr 2016, 00:17

Re: AutoHotkey doesn't work on VSCODE

Post by yokowasis » 03 Aug 2020, 21:27

boiler wrote:
03 Aug 2020, 21:19
yokowasis wrote:
03 Aug 2020, 21:00
Can your try

Code: Select all

#p::Send, ^p
This also works for me. When I press Win+P, it brings up the Quick Open menu.
You were right. It works. it means somehow, somewhere, there is an error on my code, it translate WIN + Something translate into CTRL + SHIFT + Something in vscode.

EDIT :
Apparently It's case sensitive.
My Code is :

Code: Select all

#P::Send, ^P
Which translate into ctrl+shift+p instead of Ctrl+P. Thanks for the help.

User avatar
boiler
Posts: 5604
Joined: 21 Dec 2014, 02:44

Re: AutoHotkey doesn't work on VSCODE

Post by boiler » 03 Aug 2020, 21:41

Yes, per the Send documentation (near the top):
Note: As capital letters are produced by sending the Shift key, A produces a different effect in some programs than a. For example, !A presses Alt+Shift+A and !a presses Alt+A. If in doubt, use lowercase.

Post Reply

Return to “Ask For Help”