; ; D:/m1/autoit/DoCleanSubs-3.5.13.au3 ; #include #include #include #include #include #include ; foo line 6368 is line 10 - Remove 6358 ; Test is sync or corrected in the file Local $match Local $aRetArray Local $tell = 0 $sync = 0 $corrected = 0 $ripped = 0 If @ComputerName = 'NT' Then ; $sleep = 1000 ; $sleep2 = 1500 ; $sleep3 = 2000 $sleep = 750 $sleep2 = 1250 $sleep3 = 1500 ElseIf @ComputerName = 'NT2' then $sleep = 750 $sleep2 = 1250 $sleep3 = 1500 Else $sleep = 750 $sleep2 = 1500 $sleep3 = 2000 Endif ;ConsoleWrite("$sleep: "& $sleep & @CRLF) ;exit $sTitle = "Subtitle Edit" ;Run("C:\Program Files (x86)\Subtitle Edit\SubtitleEdit.exe " & '"' & $CmdLine[1] & '"') $hdn = WinWaitActive ($sTitle, "" , 2 ) ;ConsoleWrite("$hdn: "& $hdn & @CRLF) ;Sleep($sleep) Send("^s") ;Sleep($sleep) Send("{HOME}") ;Sleep($sleep) Local $hFileOpen = FileOpen($CmdLine[1], $FO_READ+$FO_BINARY) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading the file.") Return False EndIf Local $sFileRead = FileReadLine($hFileOpen, 1) If $sFileRead <> '1' Then $unicode = 1 Else $unicode = 0 Endif ; $unicode no longer needed with customizing Mutilple replace with Shift-Control-R If _FileReadToArray($CmdLine[1], $aRetArray) Then For $i = 1 to $aRetArray[0] $match = _StringBetween($aRetArray[$i], "sync", "") If $match <> 0 Then $sync = $i Endif $match = _StringBetween($aRetArray[$i], "corrected", "") If $match <> 0 Then $corrected = $i Endif $match = _StringBetween($aRetArray[$i], "ripped", "") If $match <> 0 Then $ripped = $i Endif Next Endif ;MsgBox($MB_SYSTEMMODAL, "", "Searched File") ; #cs ; Remove HI If $tell Then MsgBox($MB_SYSTEMMODAL, "", "Remove HI.") Endif Send("^+h") Sleep($sleep) Sleep($sleep) Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}") Sleep($sleep) ; Multiple Replace If $tell Then MsgBox($MB_SYSTEMMODAL, "", "Multiple Replace.") Endif ; set shortcut to Shift-Control-R Send("^+r") Sleep($sleep2) $hdn3 = WinWaitActive ("Muliple Replace", "" , 2 ) Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}") Sleep($sleep2) Send("{ENTER}") Sleep($sleep) ; Replace all _ ; ControlClick ( $sTitle, "", "menuStrip1", "left", 1, 82, 17) If $tell Then MsgBox($MB_SYSTEMMODAL, "", "Replace all _") Endif Send("^r") Sleep($sleep) ;Send("{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}") $hdn2 = WinWaitActive ("Replace", "" , 2 ) Send("_{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}") Sleep($sleep) Send("{ENTER}") ;exit ; #ce ; Common Errors If $tell Then MsgBox($MB_SYSTEMMODAL, "", "Common Errors") Endif Send("^+f") $hdn = WinWaitActive ("Fix common error", "" , 2 ) If $tell Then MsgBox($MB_SYSTEMMODAL, "", "Fix common error: "& $hdn) exit Endif WinActivate($hdn) Sleep($sleep3) Send("{TAB}{TAB}{TAB}{TAB}{ENTER}") $ready = 0 while $ready <> 1 Sleep(200) $Text = WinGetText ("Fix common error") $match = StringInStr ( $Text, "errors" , 0) If $match > 1 then $ready = 1 ElseIf $match = StringInStr ( $Text, "nothing" , 0) If $match > 1 then $ready = 1 ElseIf $match = StringInStr ( $Text, "applied" , 0) If $match > 1 then $ready = 1 Endif Endif Endif wend ;MsgBox($MB_SYSTEMMODAL, "", "Fix common error bottom ready") Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}") Send("{ENTER}") $ready = 0 while $ready <> 1 Sleep(200) $Text = WinGetText ("Fix common error") $match = StringInStr ( $Text, "errors" , 0) If $match > 1 then $ready = 1 ElseIf $match = StringInStr ( $Text, "nothing" , 0) If $match > 1 then $ready = 1 ElseIf $match = StringInStr ( $Text, "applied" , 0) If $match > 1 then $ready = 1 Endif Endif Endif wend ;MsgBox($MB_SYSTEMMODAL, "", "Fix common error bottom ready (2)") Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}") Sleep($sleep3) Send("{ENTER}") Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}") Sleep($sleep3) Send("{ENTER}") If $sync <> 0 then ; Find Sync Sleep($sleep) Send("^f") WinWaitActive ("Find", "" , 2 ) Send("sync{ENTER}") ElseIf $ripped <> 0 Then ; Find ripped Sleep($sleep) Send("^f") WinWaitActive ("Find", "" , 2 ) Send("ripped{ENTER}") ElseIf $corrected <> 0 Then ; Find corrected Sleep($sleep) Send("^f") WinWaitActive ("Find", "" , 2 ) Send("corrected{ENTER}") Endif #cs $Text=ControlGetText("[CLASS:Notepad]","","[CLASSNN:Edit1]") $Value=StringSplit($Text,@CRLF) For $i=1 To $Value[0] If StringRegExp($Value[$i],"[0-9][^:alpha:]") Then MsgBox(0,"",$Value[$i]) EndIf Next Class: WindowsForms10.Window.8.app.0.141b42a_r26_ad1 Instance: 48 ClassnameNN: WindowsForms10.Window.8.app.0.141b42a_r26_ad148 Name: menuStrip1 Advanced (Class): [NAME:menuStrip1] ID: 3087494 Text: menuStrip1 Position: 0, 0 Size: 1605, 31 ControlClick Coords: 80, 27 Style: 0x56000000 ExStyle: 0x00010000 Handle: 0x00000000002F1C86 >>>> Control <<<< Class: WindowsForms10.BUTTON.app.0.141b42a_r26_ad1 Instance: 2 ClassnameNN: WindowsForms10.BUTTON.app.0.141b42a_r26_ad12 Name: buttonReplaceAll Advanced (Class): [NAME:buttonReplaceAll] ID: 18947888 Text: Replace &all Position: 177, 180 Size: 103, 27 ControlClick Coords: 51, 16 Style: 0x5601000B ExStyle: 0x00000000 Handle: 0x0000000001211F30 #ce