Guest User

Untitled

a guest
Feb 21st, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. ; Script Start - Add your code below here
  2. $iPID="Process.exe";имя процесса
  3. $link="";полный путь
  4. While 1
  5. $title=_ProcessGetWindow($iPID,0)
  6. If (StringInStr($title, "(Не отвечает)")) Then
  7. ProcessClose($iPID)
  8. ProcessWaitClose ($iPID)
  9. Run($link)
  10. EndIf
  11. Sleep(1000)
  12. WEnd
  13.  
  14.  
  15.  
  16.  
  17. Func _ProcessGetWindow($iPID, $iRet = 1)
  18. Local $aWinList = WinList()
  19. Local $aRet[2]
  20.  
  21. If IsString($iPID) Then
  22. $iPID = ProcessExists($iPID)
  23. EndIf
  24.  
  25. For $i = 1 To UBound($aWinList) - 1
  26. If WinGetProcess($aWinList[$i][1]) = $iPID Then
  27. $aRet[0] = $aWinList[$i][0] ;Title
  28. $aRet[1] = $aWinList[$i][1] ;WinHandle
  29.  
  30. If $iRet = 0 Then
  31. Return $aRet[0]
  32. EndIf
  33.  
  34. If $iRet = 1 Then
  35. Return $aRet[1]
  36. EndIf
  37.  
  38. Return $aRet
  39. EndIf
  40. Next
  41.  
  42. Return SetError(1, 0, $aRet)
  43. EndFunc ;==>_ProcessGetWindow
Add Comment
Please, Sign In to add comment