I'm Luke. I'm new to this AHK world. Not looking for recognition, but I thought I'd share my first functioning script.
I'm a draftsperson and CAPS ON is very useful while drawing (mostly), but painful while composing emails etc.
I have successfully reduced a tangible level of frustration from the daily grind with this script:
Code: Select all
#Persistent
SetTimer, WinActive, 500
return
WinActive:
WinGet, ActiveProcess, ProcessName, A
;MsgBox, 131136, DebugInfo1, %ActiveProcess%,
If ActiveProcess Contains acad,excel,notepad
{
GetKeyState, CapsOnOff, CapsLock, T
;MsgBox, 131136, DebugInfo2, %CapsOnOff%,
IfEqual, CapsOnOff, On
{
return
}
else
{
SetCapsLockState, On
return
}
}
WinGet, ActiveProcess, ProcessName, A
;MsgBox, 131136, DebugInfo3, %ActiveProcess%,
If ActiveProcess Contains Inventor
{
WinGetTitle, ActiveTitle, A
;MsgBox, 131136, DebugInfo4, %ActiveTitle%,
If ActiveTitle = Format%A_Space%Text
{
GetKeyState, CapsOnOff, CapsLock, T
;MsgBox, 131136, DebugInfo5, %CapsOnOff%,
IfEqual, CapsOnOff, On
{
return
}
else
{
SetCapsLockState, On
return
}
}
WinGetTitle, ActiveTitle, A
;MsgBox, 131136, DebugInfo6, %ActiveTitle%,
If ActiveTitle = Edit%A_Space%Dimension
{
GetKeyState, CapsOnOff, CapsLock, T
;MsgBox, 131136, DebugInfo7, %CapsOnOff%,
IfEqual, CapsOnOff, On
{
return
}
else
{
SetCapsLockState, On
return
}
}
}
GetKeyState, CapsOnOff, CapsLock, T
;MsgBox, 131136, DebugInfo8, %CapsOnOff%,
IfEqual, CapsOnOff, Off
{
return
}
else
{
SetCapsLockState, Off
return
}
return