AutoIt – Kill Process

email me

Func _ProcessKill($iPID)
Local $iTimeOut = 5, $iTimer

$iTimeOut *= 1000
$iTimer = TimerInit()
While ProcessExists($iPID)
If TimerDiff($iTimer) > $iTimeOut Then
ExitLoop
EndIf
RunWait('TASKKILL /F /PID ' & $iPID, @SystemDir & "\", @SW_HIDE)
Sleep(20)
WEnd
Return Number(ProcessExists($iPID) > 0)
EndFunc ;==>_ProcessKill