You can easily toggle CAPS LOCK using PowerShell, just import some virtual keyboard magic from user32.dll
:
$importDef = @"
using System.Runtime.InteropServices;
public class CapsControls
{
enum virtKeys : int
{
vkCaps = 0x14
}
[DllImport("user32.dll")]
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo);
[DllImport("user32.dll")]
static extern short GetKeyState(virtKeys nVirtKey);
public static void ToggleCaps()
{
keybd_event(virtKeys.vkCaps, 0x45, 0x1, 0);
keybd_event(virtKeys.vkCaps, 0x45, 0x3, 0);
}
public static void EnableCaps()
{
if((GetKeyState(virtKeys.vkCaps) % 2) == 0)
{
ToggleCaps();
}
}
public static void DisableCaps()
{
if((GetKeyState(virtKeys.vkCaps) % 2) != 0)
{
ToggleCaps();
}
}
}
"@
Add-Type -TypeDefinition $importDef
Now you can control caps lock from a PowerShell session:
[CapsControls]::ToggleCaps() # simulate a CAPS key press
[CapsControls]::EnableCaps() # if disabled, CAPS key press
[CapsControls]::DisableCaps() # if enabled, CAPS key press
If possible, invoke it from the application, but you could use a scheduled task to run the command every time the application is launched