Set toolkit = CreateObject("VbsEdit.Toolkit") files=toolkit.OpenFileDialog("","SRT Files (*.srt)|*.srt",False,"Open a reference subtitle file") If UBound(files)<0 Then Wscript.Quit End If
refSource = files(0)
Set toolkit = CreateObject("VbsEdit.Toolkit") files=toolkit.OpenFileDialog("","SRT Files (*.srt)|*.srt",False,"Open a subtitle file to synchronize") If UBound(files)<0 Then Wscript.Quit End If
source = files(0)
s = InputBox("Enter a few pairs of subtitles to synchronize","Synchronize","2-2,500-500,1000-1000") If s="" Then Wscript.Quit End If
arr_tt = Split(s,",")
sum_mult=0 sum_offset=0 count=0 For ii=0 To UBound(arr_tt)-1 For jj=ii+1 To UBound(arr_tt) sub1 = Split(arr_tt(ii),"-") sub2 = Split(arr_tt(jj),"-")
theText="" Do While Not(obj.EOS) text = obj.ReadText(-2)
If text="" Then Exit Do End If
Loop
Loop
obj.Close
GetSubtitleTime=theTime End Function
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