PDA

View Full Version : How to generation random character between lines in a SRT subtitle file?


hkl8324
16th June 2006, 13:11
I mean generate....:D

I am a "timer" of a fansub group and I use Sabbu (audio mode) to time.
And sadly, my group used to use SRT subtitle and the subtitle software tool "Subtitle workshop". And that software cannot load a empty SRT file (You have to put some characters in between the time code to get it working).
And actually typing something that is soon to be deleted is a waste of time in my opinioin.

So, my question is, how can I generate some random characters in between the time code lines so that Subtitle workshop can load the SRT file correctly?

(I know absolutely nothing about programming....so.....)

In case you dont get what I mean, I mean changing this:

1
00:00:00,290 --> 00:00:01,900


2
00:00:09,000 --> 00:00:11,400


3
00:00:11,400 --> 00:00:13,600


4
00:00:13,600 --> 00:00:16,230

Into this:

1
00:00:00,290 --> 00:00:01,900
fjdkjgdlsjglkdsgsg <radom character

2
00:00:09,000 --> 00:00:11,400
gdjkgljdsgklsdjgk

3
00:00:11,400 --> 00:00:13,600
gfdhhlkfdkjhdfk

4
00:00:13,600 --> 00:00:16,230

Thank you.

unmei
16th June 2006, 14:03
if it doesn't have to be random, but just something, a better text editor may let you replace all instances of "0\n\n\n" with "0\nbleh\n\n", where "\n" means newline, and you may have to use a different escape code for new lines depending on the editor.

derebo
18th January 2007, 23:58
hi,

i found same problem. couldn't find a real solution. sw can be slick for editing but not for creating from scratch. as usual, correct me if i am wrong.

greetings,

MrAyanami
21st January 2007, 22:06
unmei is completely right and I would do it the way they suggested, but if for some reason you don't have a more complex text editor I made a simple script that should add the random characters for you, assuming the format is exactly as you pasted. To use it simply drag and drop the srt onto srtfix.vbs but I would suggest backing it up before hand just incase the formatting is different than you pasted.

http://www.ayanami.co.uk/files/srtfix.vbs

If your wary of just running .vbs scripts other people have written (and I know I am myself) you can either "right click, edit" to see there is no nasty code or simply paste the following into notepad and save it as "srtfix.vbs"

Dim fso,fil,FileData,FileName

FileName = WScript.Arguments(0)

Set fso = CreateObject("Scripting.FileSystemObject")
Set fil = fso.OpenTextFile(FileName,1)
FileData = fil.ReadAll
fil.Close

Set fil = fso.OpenTextFile(FileName,2)
fil.Write Replace(FileData,vbcrlf+vbcrlf,vbcrlf+"BLAH"+vbcrlf)
fil.close

set fil = Nothing
set fso = Nothing