Skip to content

Instantly share code, notes, and snippets.

@nullstalgia
Created January 7, 2023 03:38
Show Gist options
  • Save nullstalgia/146539379cddb487d99682cecad91e28 to your computer and use it in GitHub Desktop.
Save nullstalgia/146539379cddb487d99682cecad91e28 to your computer and use it in GitHub Desktop.
An AHK Script to replace Caps Lock with "A" unless pressing Shift+Caps. Works with OVR Toolkit.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SteamVRRunning()
{
Process, Exist, vrserver.exe
If ErrorLevel = 0
{
return false
}
Else
{
return true
}
}
+CapsLock::
if !SteamVRRunning() {
if GetKeyState("CapsLock", "T") = 1
{
SetCapsLockState, off
}
else if GetKeyState("CapsLock", "F") = 0
{
SetCapsLockState, on
}
}
return
$CapsLock::
if !SteamVRRunning() {
if GetKeyState("CapsLock", "T") = 1
{
Send, A
SetCapsLockState, on
}
else if GetKeyState("CapsLock", "F") = 0
{
Send, a
SetCapsLockState, off
}
}
else
{
if GetKeyState("CapsLock", "T") = 1
{
SetCapsLockState, off
}
else if GetKeyState("CapsLock", "F") = 0
{
sendInput {CapsLock}
}
}
return
^CapsLock::
if !SteamVRRunning() {
if GetKeyState("CapsLock", "T") = 1
{
Send, ^A
SetCapsLockState, on
}
else if GetKeyState("CapsLock", "F") = 0
{
Send, ^a
SetCapsLockState, off
}
}
return
!CapsLock::
if !SteamVRRunning() {
if GetKeyState("CapsLock", "T") = 1
{
Send, !A
SetCapsLockState, on
}
else if GetKeyState("CapsLock", "F") = 0
{
Send, !a
SetCapsLockState, off
}
}
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment