windows - How to send "Ctrl+Keys" using Win32API's SendKeys function while CapLock and Ctrl are swappe

admin2025-04-17  2

I use PowerToys to remap Left Ctrl to CapLock and remap CapLock to Left Ctrl. Yet, I am using a Sublime Text plugin which uses python's win32com.client.Dispatch("WScript.Shell").SendKeys function to send keybindings such as "Ctrl+A" ("^a") and "Ctrl+V" ("^v").

However, since Left Ctrl and CapLock are swapped using PowerToys, I find that every time SendKeys("^a") is executed, CapLock is pressed first, followed by "a", so it prints "A".

Is there a way to work around this, e.g. letting SendKeys ignore PowerToy's key remapping? Thanks!

I use PowerToys to remap Left Ctrl to CapLock and remap CapLock to Left Ctrl. Yet, I am using a Sublime Text plugin which uses python's win32com.client.Dispatch("WScript.Shell").SendKeys function to send keybindings such as "Ctrl+A" ("^a") and "Ctrl+V" ("^v").

However, since Left Ctrl and CapLock are swapped using PowerToys, I find that every time SendKeys("^a") is executed, CapLock is pressed first, followed by "a", so it prints "A".

Is there a way to work around this, e.g. letting SendKeys ignore PowerToy's key remapping? Thanks!

Share asked Feb 1 at 16:44 L. Francis CongL. Francis Cong 3592 silver badges9 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Sorry that I found a solution seconds after posting this... Remapping Right Ctrl to CapLock solves the problem.

转载请注明原文地址:http://anycun.com/QandA/1744823274a88110.html