Jump to content

Recommended Posts

Posted

I'm trying to detect a background process. I have a main sript and i will mace a MsgBot, when the script crashes. I have a second Script which should scan whether the process is still running. But

ProcessExists

and

FileExists

dont work. These commands scan for a main script or file but not for a background script

Posted (edited)

Ok change the hidden AutoIt title with AutoItWinSetTitle.  You can then WinGetProcess easily.  See help file and example to understand how to do it.

Another option is to get ProcessList and kill those processes that are not equal to @AutoItPID (current process).

Edited by Nine
Posted (edited)

You did not study the examples in help file as I had suggested, did you ?

Anyway, it is not very complicated.

First script must do :

AutoItWinSetTitle("My AutoIt Window")

Second script will do :

Local $hWnd = WinGetHandle("My AutoIt Window")
If @error Then Exit
ConsoleWrite ($hWnd & @CRLF)
Local $iPID = WinGetProcess($hWnd)
ConsoleWrite ($iPID & @CRLF)
Local $iRes = ProcessClose ($iPID)
ConsoleWrite ($iRes & "/" & @error & @CRLF)

 

Edited by Nine

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...