Advertisement
Guest User

Rectal Prolapse

a guest
Apr 27th, 2009
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 3.70 KB | None | 0 0
  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ; mpeg2auto.au3
  3. ; takes one argument - the name of the input file.
  4. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  5.  
  6. ; If you compile this to an EXE, make sure this is compiled with the Console
  7. ; option enabled otherwise it will not work in a batch file!
  8. Run("C:\Program Files\mpeg2repair\mpeg2repair.exe")
  9. WinWaitActive("MPEG2Repair")
  10. ; Track the process ID and windows handle of the mpeg2repair instance we launched - save them
  11. ; for later. We want to track them so that we know that any dialog boxes it pulls up belong To
  12. ; us.
  13. $hMPEG2RepairHandle = WinGetHandle("MPEG2Repair")
  14. $pidMPEG2Repair = WinGetProcess($hMPEG2RepairHandle)
  15. ; Fill in the input filename
  16. if $CmdLine[0] < 1 Then
  17.     ;$ABC = "D:\Current\c-bubble\Baburu.e.go!!.Taimu.mashin.wa.doramu-shiki.2007.AAC5.1.JPN.ts"
  18.     ;ControlSetText($hMPEG2RepairHandle, "", "[CLASS:Edit; INSTANCE:1]", $ABC)
  19.     Exit 1
  20. Else
  21.     ControlSetText($hMPEG2RepairHandle, "", "[CLASS:Edit; INSTANCE:1]", $CmdLine[1])
  22. EndIf
  23.  
  24. ; Press the PID scan button - then wait for it to complete
  25. ControlClick($hMPEG2RepairHandle, "", "[CLASS:Button; INSTANCE:7]");
  26. Do
  27.     Sleep(100)
  28.     $StatusString = ControlGetText($hMPEG2RepairHandle, "", "[CLASS:Static; INSTANCE:9]")
  29.     $result = StringInStr($StatusString, "100 % Completed", 0)
  30. Until $result > 0
  31. ; Check the logging option
  32. ControlClick($hMPEG2RepairHandle, "", "[CLASS:Button; INSTANCE:5]");
  33. ; Click on the Start button
  34. ControlClick($hMPEG2RepairHandle, "", "[CLASS:Button; INSTANCE:7]");
  35.  
  36. ; There is a chance the user aborted us - check for this!
  37. if WinExists($hMPEG2RepairHandle) == 0 Then
  38.     exit 1
  39. EndIf
  40.  
  41. ; First we wait until the start button text is changed to say "Cancel".
  42. ; There may also be an overwrite dialog box or an error box popping up too.
  43. While StringInStr(ControlGetText($hMPEG2RepairHandle, "", "[CLASS:Button; INSTANCE:7]"), "CANCEL", 0) == 0
  44.     ; We might get asked to overwrite a previously existing log - always say yes!
  45.     $var = WinList()
  46.     For $i = 1 to $var[0][0]
  47.         ; we might get asked to overwrite --- search for the warning if it exists!
  48.         ; Only answer visible windows that belong to our mpeg2repair
  49.         If StringInStr($var[$i][0], "Warning:") AND (WinGetProcess($var[$i][1]) == $pidMPEG2Repair) Then
  50.             ;MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1])
  51.             ControlClick($var[$i][1], "", "[CLASS:Button; INSTANCE:1]")
  52.             WinWaitClose($var[$i][1])
  53.         EndIf
  54.         ; check for error!
  55.         If StringInStr($var[$i][0], "Error:") AND (WinGetProcess($var[$i][1]) == $pidMPEG2Repair) Then
  56.             ;MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1])
  57.             ControlClick($var[$i][1], "", "[CLASS:Button; INSTANCE:1]")
  58.             WinWaitClose($var[$i][1])
  59.             WinClose($hMPEG2RepairHandle)
  60.             Exit 1
  61.         EndIf
  62.     Next
  63.     Sleep(100)
  64. WEnd
  65.  
  66. ; Wait until logging is complete
  67. Do
  68.     ; There is also a chance that mpeg2repair has an error - if so, we exit and return an error code!
  69.     $var = WinList()
  70.     For $i = 1 to $var[0][0]
  71.         If StringInStr($var[$i][0], "Error:") AND (WinGetProcess($var[$i][1]) == $pidMPEG2Repair) Then
  72.             ;MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1])
  73.             ControlClick($var[$i][1], "", "[CLASS:Button; INSTANCE:1]")
  74.             WinWaitClose($var[$i][1])
  75.             WinClose($hMPEG2RepairHandle)
  76.             Exit 1
  77.         EndIf
  78.     Next
  79.  
  80.     Sleep(1000)
  81.  
  82.     $StatusString = ControlGetText($hMPEG2RepairHandle, "", "[CLASS:Static; INSTANCE:9]")
  83.     $result = StringInStr($StatusString, "100 % Completed", 0)
  84.     ; There is a chance the user aborted us - check for this!
  85.     if WinExists($hMPEG2RepairHandle) == 0 Then
  86.         Exit 1
  87.     EndIf
  88. Until $result > 0
  89.  
  90. WinClose($hMPEG2RepairHandle)
  91. Exit 0
  92.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement