Zend certified PHP/Magento developer

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

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

I’ve tried this:

Loop {    
  if WinExist("ahk_exe pycharm64.exe") 
  WinWaitClose, ahk_exe pycharm64.exe    
  Run, "C:Program Files (x86)QTranslateQTranslate.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 doesn’t exist.