Download sample SRT files

' Open SRT file (subtitles) in Google Chrome to translate it
' Video

Set toolkit = CreateObject("VbsEdit.Toolkit")
files=toolkit.OpenFileDialog("","SRT Files (*.srt)|*.srt",False,"Open a subtitle file")
If UBound(files)<0 Then
  Wscript.Quit
EndIf

source = files(0)
dest = source & ".htm"

Set objOutput = CreateObject("ADODB.Stream")
objOutput.Charset = "utf-8"
objOutput.Type = 2
objOutput.Open
objOutput.LineSeparator = -1

objOutput.WriteText "<html><body>",1

Set objInput = CreateObject("ADODB.Stream")
objInput.Charset = toolkit.charset(source)
objInput.Type = 2
objInput.LineSeparator = toolkit.lineseparator(source)
objInput.Open
objInput.LoadFromFile source

DoWhileTrue

  IfNot(objInput.EOS) Then
    num = objInput.ReadText(-2)
  Else
    ExitDo
  EndIf
   
  objOutput.WriteText "<span class=""notranslate"">" & num & "</span><BR>",1
  
  IfNot(objInput.EOS) Then
    tt = objInput.ReadText(-2)
  Else
    ExitDo
  EndIf
   
  objOutput.WriteText "<span class=""notranslate"">" & tt & "</span><BR>",1
  
  DoWhileNot(objInput.EOS)
    text = objInput.ReadText(-2)
   
    objOutput.WriteText text & "<BR>",1

    If text=""Then
      ExitDo
    EndIf
  
  Loop
  
Loop

objInput.Close
objOutput.WriteText "</body></html>",1
objOutput.SaveToFile dest,2
objOutput.Close

Set WshShell = WScript.CreateObject("Wscript.Shell")

OnErrorResumeNext
chrome = wshshell.RegRead("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe\")
If Err.number<>0 Then
  chrome = wshshell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe\")
EndIf

Set fso = WScript.CreateObject("Scripting.Filesystemobject")

If fso.FileExists(chrome) Then
  wshshell.Run """" & chrome & """ """ & dest & """",1,False
Else
  WScript.Echo "could not locate Chrome."
EndIf


search for scripts

VbsEdit contains all these sample scripts!


Download Now!



Download   Home   Scripts

Copyright © 2001-2024 adersοft