meb

Restarting an Application that stalls:

meb
Dec 20th, 2014
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. Restarting an Application that stalls:
  2. This script runs an auto complete text, program that for some reasons stalls at an unexpected times and has to mainly has to be quit; and restarted. I would like it to automatically be restarted every minutes; or if possible if the script can tell when it stalls.
  3.  
  4. Premade Script:
  5. ;
  6. ; AutoHotkey Version: 1.x
  7. ; Language: English
  8. ; Platform: WinXP/7
  9. ; Author: studotwho
  10. ;
  11. ; Script Function:
  12. ; Restarts the iTeleportConnect service if it hasn't started - this usually happens if your
  13. ; wireless network interface hasn't started when iTC tries to connect.
  14. ;
  15. ; This script loops every (45) seconds to determine if iTC is running or not, and restarts it if it's not.
  16. ;
  17.  
  18. #SingleInstance, force
  19. SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
  20. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
  21.  
  22. iTC_EXE = G:\PortableApps\TexterPortable\App\texter\texter.exe
  23. iTC_Path = G:\PortableApps\TexterPortable\App\
  24. iTC_imgName =texter.exe
  25.  
  26. loop {
  27. sleep 45000
  28. Process, Exist, %iTC_imgName% ; check to see if texter.exe is running
  29. If (ErrorLevel = 0) ; If it is not running
  30. {
  31. Run, %iTC_EXE%, %iTC_Path%, hide
  32. }
  33. Else ; If it is running, ErrorLevel equals the process id for the target program (Printkey). Then do nothing.
  34. {
  35. sleep 5
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment