Question

I was wondering if i could get AHK-script to automatically launch a program in the background when i start another.

Example:

Execute C:\any.exe. AHK launches: C:\monitor.exe

When any.exe is closed, ahk should kill monitor.exe

Awsome if you guys could help me.

Edit: Note that i am a complete newcomer to programming or scripting in every way you can think of

Was it helpful?

Solution

Check out timer in the autohotkey docs.

You could set a timer that checks every 5 seconds to run winexist to test for the existence of c:\any.exe - and when it returns true then your code could run c:\monitor.exe

Now that your code knows that c:\any.exe is running, your code could launch a second timer that checks for when its process is closed (check out process in the ahk docs). When it is closed, then use winkill to close the c:\monitor.exe process.

So, look up these commands:

  • winexist
  • timer
  • process
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top