Set toolkit = CreateObject("VbsEdit.Toolkit") files=toolkit.OpenFileDialog("","SRT Files (*.srt)|*.srt",False,"Open a subtitle file") If UBound(files)<0 Then Wscript.Quit End If
source = files(0)
Set fso = CreateObject("Scripting.Filesystemobject")
If Not(fso.FileExists(source & ".bak")) Then fso.CopyFile source,source & ".bak",False End If
dest = files(0)
s = InputBox("Enter a number of seconds","Shift","0") If s="" Then Wscript.Quit End If
If InStr(CStr(1/2), ".") > 0 Then s=Replace(s,",",".") Else s=Replace(s,".",",") End If
offset =CDbl(s)
from_time= "" until_time = ""
shift_from=0 If from_time<>"" Then shift_from = StringToSeconds(from_time) End If
shift_until=10^8 If until_time<>"" Then shift_until = StringToSeconds(until_time) End If
Function SecondsToString(seconds) Dim t t=seconds h=Int(t/3600) t=t-h*3600 If Len(h)=1 Then h="0" & h End If n= Int(t/60) t=t-n*60 If Len(n)=1 Then n="0" & n End If s = Int(t) If Len(s)=1 Then s="0" & s End If m=t-s m=FormatNumber(m,3)
SecondsToString = h & ":" & n & ":" & s & "," & Mid(m,3) End Function
Function StringToSeconds(str)
arr=Split(str,":")
t = arr(0)*3600 + arr(1)*60
s = Split(arr(2),",")
If UBound(s)>=0 Then t = t + s(0)
If UBound(s)>=1 Then t = t + s(1)/1000 End If End If