Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Set a macro to run whenever a particular window is activated
#4
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"     Help - how to add the trigger to the macro
Code:
Copy      Help
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 CapsLock

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.


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)