'用途:結合MP4檔案 '目錄:同目錄下的youku檔案結合後移到./output '需要先安裝\bin\MP4Box.exe '不建議同時多次執行本腳本 Dim FileName Dim FileNamePart Dim FileNamePre Dim FileNameOutput Dim FileNameOutputTemp Dim StrSplit Dim WshShellCmd Dim ArgCount 'WScript.Echo GetLocale Set ArgObj = WScript.Arguments ArgCount = WScript.Arguments.Count FileName = "[新] 松本人志のコントMHK #1 - 11.11.05_part-00.mp4" If ArgCount > 0 Then FileName = ArgObj(0) Else Wscript.Echo "ArgCount is 0" Wscript.Quit 1 ' End If StrSplit = "_part-" FileNamePreFix = RandomString() FileNameOutputTemp = FileNamePreFix&"Temp.mp4" FileNamePre = Left(FileName ,InStr(FileName,StrSplit) - 1) FileNameOutput = FileNamePre & ".mp4" InputPath = "..\input" OutputPath = "..\output\" WshShellCmd = "..\bin\MP4Box.exe " 'Wscript.Echo Right("00" & LCase(HEX(32)) , 2 ) 'Wscript.Quit 1 Dim FileSys Set FileSys = CreateObject("Scripting.FileSystemObject") For i=0 to 64 FileNamePart = FileNamePre & StrSplit & Right("00" & LCase(HEX(i)) , 2 ) & ".mp4" FileNameAfter = FileNamePreFix & i & ".mp4" If FileSys.FileExists(FileNamePart) Then FileSys.MoveFile FileNamePart , FileNameAfter WshShellCmd = WshShellCmd & " -cat """ & FileNameAfter & """" End If Next 'Set WshShellCmdFile = FileSys.CreateTextFile("WshShellCmd.txt", True) 'WshShellCmdFile.WriteLine WshShellCmd 'WshShellCmdFile.Close WshShellCmd = WshShellCmd & " """ & FileNameOutputTemp & """" 'Wscript.Echo WshShellCmd 'Wscript.Quit 1 Set WshShell = WScript.CreateObject("WScript.Shell") Ret = WshShell.Run( WshShellCmd , 1, True ) If Ret = 0 Then FileSys.MoveFile FileNameOutputTemp , FileNameOutput FileSys.MoveFile FileNameOutput , OutputPath & FileNameOutput Else FileSys.DeleteFile FileNameOutputTemp End If If Ret = 0 Then For i=0 to 64 FileNamePart = FileNamePre & StrSplit & Right("00" & LCase(HEX(i)) , 2 ) & ".mp4" FileNameAfter = FileNamePreFix & i & ".mp4" If FileSys.FileExists( FileNameAfter ) Then 'FileSys.MoveFile i & ".mp4" , FileNamePart FileSys.DeleteFile FileNameAfter End If Next Else For i=0 to 64 FileNamePart = FileNamePre & StrSplit & Right("00" & LCase(HEX(i)) , 2 ) & ".mp4" FileNameAfter = FileNamePreFix & i & ".mp4" If FileSys.FileExists( FileNameAfter ) Then FileSys.MoveFile FileNameAfter , FileNamePart 'FileSys.DeleteFile i & ".mp4" End If Next End If 'WshShell.Run WshShellCmd , 6, True 隱藏式窗 'WScript.Echo "return -" & Ret Set WshShell = Nothing Set FileSys = Nothing Set ArgObj = Nothing function RandomString( ) Randomize( ) dim CharacterSetArray CharacterSetArray = Array( _ Array( 3, "abcdefghijklmnopqrstuvwxyz" ), _ Array( 1, "0123456789" ) _ ) dim i dim j dim Count dim Chars dim Index dim Temp for i = 0 to UBound( CharacterSetArray ) Count = CharacterSetArray( i )( 0 ) Chars = CharacterSetArray( i )( 1 ) for j = 1 to Count Index = Int( Rnd( ) * Len( Chars ) ) + 1 Temp = Temp & Mid( Chars, Index, 1 ) next next dim TempCopy do until Len( Temp ) = 0 Index = Int( Rnd( ) * Len( Temp ) ) + 1 TempCopy = TempCopy & Mid( Temp, Index, 1 ) Temp = Mid( Temp, 1, Index - 1 ) & Mid( Temp, Index + 1 ) loop RandomString = TempCopy end function
文章標籤
全站熱搜
創作者介紹
創作者 abort 的頭像
abort

推理文by阿誠

abort 發表在 痞客邦 留言(0) 人氣(688)