09-21-2012, 03:49 AM
Using code from this forum: Tips: QM code in the forum (colors, functions, dialogs, etc)
Here is with comments.
Function auto_caps_lock
Trigger !a"Notepad" "Notepad"
By default, part of window name can be specified in trigger, eg "Notepad" will also match "Untitled - Notepad". If checked 'Use *', window name must be full or with wildcard characters. Also can be used regular expression. In Properties press F1 to read more.
Here is with comments.
Function auto_caps_lock
Trigger !a"Notepad" "Notepad"

int hwnd=val(_command) ;;get handle of the trigger window
ifk-(K 1) key K ;;if CapsLock not toggled, press CapsLock
wait 0 -WA hwnd ;;wait for the trigger-window inactive
ifk(K 1) key K ;;if CapsLock toggled, press CapsLockBy default, part of window name can be specified in trigger, eg "Notepad" will also match "Untitled - Notepad". If checked 'Use *', window name must be full or with wildcard characters. Also can be used regular expression. In Properties press F1 to read more.
