How to Automatically run a specific program when another specific program is closed?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
yfjuu6
Posts: 124
Joined: 28 Apr 2023, 15:28

How to Automatically run a specific program when another specific program is closed?

Post by yfjuu6 » 08 Jun 2023, 16:08

I want "ahk_exe QTranslate.exe" to be running automatically in system tray as soon as another "ahk_exe pycharm64.exe" is closed.

I've tried this :

Code: Select all

Loop {

if WinExist("ahk_exe pycharm64.exe")

WinWaitClose, ahk_exe pycharm64.exe

Run, "C:\Program Files (x86)\QTranslate\QTranslate.exe",,hide

}
The problem with this is that the "QTranslate" window always appears continuously, and when I close it, It appears and appears without stopping, and "QTranslate" does not start running in the system tray, that happens when "ahk_exe pycharm64.exe" does'nt exist.

- Please help! Thanks.

User avatar
mikeyww
Posts: 26848
Joined: 09 Sep 2014, 18:38

Re: How to Automatically run a specific program when another specific program is closed?

Post by mikeyww » 08 Jun 2023, 16:34

If pycharm has no window or a hidden window, you might have a problem. The Process command might help in some situations like this.

Your loop probably also needs adjustment. At the end of the loop, you probably want to wait for some process to exist before the loop continues to its next iteration.

Post Reply

Return to “Ask for Help (v1)”