不錯哦~
不過剛剛試了個UTF-8的 ass 結果變成亂碼 ※日文字
又改成 Unicode 轉不出內容,style 是當初的 .ass內容,且變成亂碼
轉成 DVD用的字幕會更好^^ (要求太過份了^^||)
其實是那個雙字元組造成的
VBScript 裡的字串運算都會自動轉成雙字元的
所以請善用
AscB、MidB、LenB
==================
個人前陣子寫的加解密腳本讓您參考
========加密=======
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fsot, ft
Dim ValCrypt
Dim BoolMsg
On Error Resume Next
ValCrypt = Cint(InputBox("請輸入加密密碼 ※需為大於等於100之正整數"))
BoolMsg = MsgBox("是否指定單一文件加密(答""否""的話就是使用 Crypt.List批次處理)",vbYesNoCancel,"指定加密文件")
If BoolMsg = vbNo Then
Set fsot = CreateObject("Scripting.FileSystemObject")
Set ft = fsot.OpenTextFile("Crypt.List", ForReading)
While Not ft.AtEndOfStream
ReadWriteFile ft.ReadLine
Wend
ElseIF BoolMsg = vbYes Then
ReadWriteFile InputBox("請輸入File完整名稱")
End IF
On Error GoTo 0
Sub ReadWriteFile(FileNameStr)
Dim fso, f1, f2, i
Dim NewText, ReadAllTextFile
Dim ValTristate
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.OpenTextFile(FileNameStr, ForReading, False, TristateUseDefault)
Set f2 = fso.OpenTextFile(FileNameStr, ForReading, False, TristateTrue)
ReadAllTextFile = f1.ReadAll
NewText = f2.ReadAll
If StrComp(ReadAllTextFile, NewText) Then
ValTristate = TristateUseDefault '開啟檔案為系統預設狀態
Else
ValTristate = TristateTrue 'Unicode
End If
f2.Close
NewText = Empty
ReadAllTextFile = StrReverse(ReadAllTextFile)
For i = 1 to LenB(ReadAllTextFile)
NewText = NewText + CStr(AscB(MidB(ReadAllTextFile, i, 1)) + ValCrypt)
Next
Set f1 = fso.OpenTextFile(FileNameStr + ".Crypt", ForWriting, True, ValTristate)
f1.Write NewText
End Sub
=======解密========
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fsot, ft
Dim ValCrypt
Dim BoolMsg
On Error Resume Next
ValCrypt = Cint(InputBox("請輸入當初設定之文件解密密碼(正整數)"))
BoolMsg = MsgBox("是否解密所有.Crypt文件(答""是""的話會根據Crypt.List文件列表;答""否""的話請輸入單一文件)",vbYesNoCancel,"指定解密文件")
If BoolMsg = vbYes Then
Set fsot = CreateObject("Scripting.FileSystemObject")
Set ft = fsot.OpenTextFile("Crypt.List", ForReading, False, TristateUseDefault)
While Not ft.AtEndOfStream
ReadWriteFile ft.ReadLine, ValCrypt
Wend
ElseIF BoolMsg = vbNo Then
ReadWriteFile InputBox("請輸入文件完整名稱"), ValCrypt
End IF
On Error GoTo 0
Sub ReadWriteFile(FileNameStr, ByValCrypt)
Dim fso, f1, f2, i
Dim NewText, ReadAllTextFile
Dim ValTristate, ValLen
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.OpenTextFile(FileNameStr + ".Crypt", ForReading, False, TristateUseDefault)
Set f2 = fso.OpenTextFile(FileNameStr + ".Crypt", ForReading, False, TristateTrue)
ReadAllTextFile = f1.ReadAll
NewText = f2.ReadAll
If StrComp(ReadAllTextFile, NewText) Then
ValTristate = TristateUseDefault '開啟檔案為系統預設狀態
Else
ValTristate = TristateTrue 'Unicode
End If
f2.Close
NewText = Empty
ValLen = Len(CStr(ByValCrypt))
For i = 1 to Len(ReadAllTextFile) Step ValLen
NewText = NewText + ChrB(CInt(Mid(ReadAllTextFile, i, ValLen))- ByValCrypt)
Next
NewText = StrReverse(NewText)
Set f1 = fso.OpenTextFile("Decode_" + FileNameStr, ForWriting, True, ValTristate)
f1.Write NewText
End Sub