How to run task when app is open and close it when app is closed?


  1. Posts : 19
    Windows 10 Pro X64
       #1

    How to run task when app is open and close it when app is closed?


    Hi there,

    I'd like to know how I can run a specific file (a single executable that runs in the background by default/AHK script) the moment a specific program launches and close when that app is closed

    Windows 10 Pro x64

    Kind regards
      My Computer


  2. Posts : 42,916
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #2

    Use this statement to test for the presence/ absence of the process in an appropriate loop.
    How to run task when app is open and close it when app is closed?-1.jpg

    Within an endless loop:

    In loop 1:
    if the positive test is true launch the program (whatever that may be)
    In loop2:
    If the process ceases to exist, close the program.

    How to run task when app is open and close it when app is closed?-1.jpg

    Autohotkey comes with extensive help. It's easy to try things with it, but some simple things may take multiple attempts.

    If unfamiliar, just try a single statement at a time- e.g. a script which launches your program, then closes it.
    Then move on to IfWinexist
    etc.
    There's an active forum dedicated to Autohotkey.
      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 05:23.
Find Us




Windows 10 Forums