Homepage
Menu
Use ControlSend in AutoHotKey to send a key combo to a background app

Use ControlSend in AutoHotKey to send a key combo to a background app

Using AutoHotKey v1.1 (should I use v2.0? Who knows?!) I wanted to perform the following:

- With ocenaudio.exe already recording an audio source in an unfocused window in the background
- using an arbitrary global key combo like ctrl+alt+k
- send ctrl+k to ocenaudio.exe, adding a record maker at that instant, without bringing the app to the foreground
- once verified, assign one of the media keys on this Logitech k400r to send ctrl+alt+k with one tap. This is configured using the Logitech Setpoint app.

The purpose is to be able to monitor various media like videos, tapes, records, etc, and set markers for where I will go back later and crop out audio samples.

Here's a working script:

^!k::
hWnd := WinExist("ahk_exe ocenaudio.exe")
ControlSend,, ^k, ahk_id %hWnd%
Return