UDF are add-on function for kixtart. They are cerate by users and can be inserted in the script or called from the script. They will get loaded into memory when the script starts and if all goes well they can be used as any other function native to kix. UDF come as they are and should not have to be changed unless you want something extra from it. Enumproccess in this case does exactly what you want it to.

Here's an example that uses enumproccess to see if notepad is running and does something when notepad is not running You should change notepad.exe in the $pid= EnumProcess("notepad.exe") line to the app you want to monitor and you should add a line that actually uses Blat (or some other mail app) to send you a message that app x is no longer running.

 Code:
Break on

$pid= EnumProcess("notepad.exe")

If $pid = ""
	?"Notepad is NOT running."
	Sleep 5
EndIf


;Function EnumProcess($exe, optional $terminate, optional $Computer)
;
;To enumerate OR kill specific processes
;
;$exe: the process name OR numeric PID
;$terminate: null/notnull value to terminate the specified process(es)
;$Computer: the PC to Execute against. Null = local PC
;
;returns an array of PIDs (pipe seperated), If $exe is a process name
;
;To Return the pid of setup.exe
;$pid= EnumProcess("setup.exe")
;
;to terminate all running Internet Explorer windows
;$kill= EnumProcess("iexplore.exe",1)
;
;To terminate a specific exe by it's PID
;$pid=694
;$kill=EnumProcess($pid,1)
;
;Code: 
Function EnumProcess($exe, optional $terminate, optional $Computer)
	Dim $winmgmts, $ExecQuery, $Process, $id, $GetObject, $
	If NOT $computer	$computer=@wksta	EndIf
	$winmgmts="winmgmts:{impersonationLevel=impersonate}!//$COMPUTER"
	Select
		Case Val($exe)>0
			$ExecQuery="select * from Win32_Process where ProcessId='$exe'"
			$GetObject=GetObject($winmgmts).ExecQuery($ExecQuery)
			For Each $Process in $GetObject
				If $terminate		$=$Process.Terminate	EndIf
				$EnumProcess = $Process.name
				Next
			$GetObject=''
		Case VarType($exe)=8
			$ExecQuery="select * from Win32_Process where Name='$exe'"
			$GetObject=GetObject($winmgmts).ExecQuery($ExecQuery)
			For Each $Process in $GetObject
				If $terminate		$=$Process.Terminate	EndIf
				$id=$Process.ProcessId
				$EnumProcess = "$Id" + "|" + "$EnumProcess"
				Next
			$EnumProcess=Left($EnumProcess,Len($EnumProcess)-1)
			$GetObject=''
		Case 1
			Exit 1
		EndSelect
	EndFunction
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.