When the caps lock is "stuck"... normal typing triggers all of my various AHK macros- a nightmare! It does not get stuck at predictable times, and not always. But often.
My main .AHK file is massive and has some personal information, so I can't really paste it all here. I'll paste what I think is the relevant parts.
Note... hitting "caps lock" and sometimes other keys seems to reset everything.
Also note... I've tried all forms of:
SendInput, {CapsLock}
SetCapsLockState, AlwaysOff
In a loop, after keys are hit... nothing seems to work.
Code: Select all
#NoEnv
#Persistent
#InstallKeybdHook
#UseHook
SendMode Input
SetCapsLockState, AlwaysOff
F1:: Return
Insert:: Send %A_Tab%
#If GetKeyState("Capslock", "P")
4::SendInput, TEXTHERE
5::SendInput, TEXTHERE
NumpadEnter::Run calc.exe
S & U::
SendInput, {enter}MY EMAIL SIGNATURE HERE{enter}ON MULTIPLE LINES
Exit
T::
FormatTime, Time,, M/d/yyyy h:mm tt
SendInput, %Time%
Exit
F5::
FormatTime, TimestampS,, yyyy-MM-dd
SendInput, %TimestampS%
Exit
F6::
FormatTime, Timestamp,, yyyy-MM-dd-HH-mm
SendInput, %Timestamp%
Exit
; ------------------------------------------------------------------------------------------------------------------------
#If MouseIsOver("ahk_class Shell_TrayWnd")
WheelUp::Send {Volume_Up}
WheelDown::Send {Volume_Down}
~LButton::
If (A_TimeSincePriorHotkey<400) and (A_TimeSincePriorHotkey<>-1){
Send #m
;Send {f5}
}
Return
; --------------------------------------------------------------------------------------------------------------------------
MouseIsOver(WinTitle) {
MouseGetPos,,, Win
return WinExist(WinTitle . " ahk_id " . Win)
}
GenerateRandomString(length = 8) {
characters := "abcdefghijklmnopqurstuvwxyzABCDEFGHIJKLMNOPQURSTUVWXYZ0123456789@$%&*()_;:?<>-"
StringSplit, chars, characters
uppercases := "ABCDEFGHIJKLMNOPQURSTUVWXYZ"
StringSplit, ucases, uppercases
lowercases := "abcdefghijklmnopqurstuvwxyz"
StringSplit, lcases, lowercases
numbers := "0123456789"
StringSplit, nums, numbers
specials := "@$%&*()_;:?<>-"
StringSplit, specs, specials
Loop, %length%
{
Random, rand, 1, 78
password .= chars%rand%
}
Random, rand, 1, 10
password .= nums%rand%
Random, rand, 1, 26
password .= lcases%rand%
Random, rand, 1, 14
password .= specs%rand%
Random, rand, 1, 26
password .= ucases%rand%
return password
}
; ------------------------------------------------------------------------------------------------------------------------