brotherS wrote:
Code:
;remotely run and quit Ghoster.exe
^+p::
Process, Exist, Ghoster.exe
pid=%ErrorLevel%
If pid=0
Run,D:\files\program files\Autohotkey\Ghoster.exe
Else
WinClose, Ghoster
Return
Damn, I just CAN'T get this to work again! Neither DetectHiddenWindows nor various other things I tried were helping...
I confirmed with "MsgBox, test" that the script itself IS working, it just won't close the process!
I then tried to use Ghoster.exe (that's its name in the Task Manager) there instead of just Ghoster, together with the "process" command instead of WinClose, but that didn't work either
I then tried to use the full path for the Ghoster.exe and the "process" command - same result

...
I then cursed a bit more and tried this:
Code:
^+o::
DetectHiddenWindows, On
Process, Close, fdm.exe
return
fdm.exe is another running exe but - again - the process command won't work!
...
A few more minutes passed while I tried several things - and suddently BOTH triggers were working correctly?!? Any explanation? Anyone?
What follows is the working version of the script, I really hope it will continue to work - but why isn't it removing Ghoster's tray icon when it closes the process?
Code:
;2005-11-29
;remotely run and quit Ghoster.exe
#Persistent
^+p::
DetectHiddenWindows, On
Process, Exist, Ghoster.exe
pid=%ErrorLevel%
If pid=0
Run, D:\Eigene Dateien\program files\Autohotkey\Ghoster.exe
Else
Process, Close, Ghoster.exe
Return
_________________
DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional
donation to its developer, Chris Mallett.