12/07/21 08:06:13.11 3H5ntt4l
>>261 を勝手にいじってみた。入力は.chapters.txt のみ、出力はchapter.txt (chapter.aufとかでつかえる奴)
TvtPlayはchapter.txtも読めるしこの形式のが汎用だとおもう。チャプター名もでる
Option Explicit
Dim fs, re, m, reader, writer, i, line, chapters
Set fs = WScript.CreateObject("Scripting.FileSystemObject")
if WScript.Arguments.Unnamed.Count < 2 then
WScript.echo "[USAGE] CScript tochapter.vbs <input> <output>" & vbCRLF & "<input> .chapters.txt" & vbCRLF & "<output> newfile name (eg: hoge.chapter.txt)"
elseif Not fs.FileExists(WScript.Arguments.Unnamed.Item(0)) then
WScript.echo "[ERR] 指定ファイルねぇぞゴルァ"
else
Set reader = fs.OpenTextFile(WScript.Arguments.Unnamed.Item(0), 1, False)
Set re = New RegExp
re.Pattern = "^([\d:\.]+) (.*)"
Do Until reader.AtEndOfStream
line = reader.ReadLine
Set m = re.execute(line)
if m.Count > 0 then
chapters = chapters & "CHAPTER" & Right(i + 100, 2) & "=" & m(0).SubMatches(0) & vbCRLF
chapters = chapters & "CHAPTER" & Right(i + 100, 2) & "NAME=" & m(0).SubMatches(1) & vbCRLF
i = i + 1
end if
Loop
reader.Close()
Set writer = fs.CreateTextFile(WScript.Arguments.Unnamed.Item(1), True)
writer.Write(chapters)
writer.Close()
end if