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

  1. Posts : 2
    Windows 10 Pro X64
       01 Mar 2018 #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 ComputerSystem Spec

  2.    02 Mar 2018 #2

    Use this statement to test for the presence/ absence of the process in an appropriate loop.
    Click image for larger version. 

Name:	1.jpg 
Views:	1 
Size:	129.7 KB 
ID:	179117

    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.

    Click image for larger version. 

Name:	1.jpg 
Views:	1 
Size:	99.6 KB 
ID:	179118

    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
    There's an active forum dedicated to Autohotkey.
      My ComputerSystem Spec


Related Threads
my computer upgraded,& now when i wake up ,the same program that i closed the night before is open. anyone have the same thing happening?
Okay, not sure if this is the correct subforum (i figured it was either this one or Software & Apps), but here's what I'm trying to do. I have a game launcher set, from within it's own settings, to automatically close when launching a game. What...
I cannot get it to work that Windows Task Scheduler closes a program each day. I have added this path C:\Dir Lw C\Programme\Rainlendar - Dirks Kalender (Daten etc.)\RainlendarPro schließen.lnk to a new task and the ink file is containing this...
Hello, I'm new member here. I wanted to ask about my problem after anniversary update. problem doesn't occured on Windows 10 previous build. Though it was happen before when I was on Windows 8.1, so I refresh windows and it worked again. But...
10547. Really weird behavior. Dism and sfc scannow are not working. I type them in and then cursor goes to next line and nothing happens. A second cmd window opens for less than a second and closes out. Not sure why that is happening. Other weird...
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 12:39.
Find Us