#17281
Stefan
Participant

You may want to try this script on COPIES of your srt subtitles files.

1.) save this script as a textfile with JS extension or as a snippet to the snippet plugin.
2.) load your srt file
3.) execute that script one time for every line to modify. The script will tell you if nothing more is found.

If this works and you have saved this script to a file, you can utilize menu “Macros > Run wit temporary Options…” to let it run more than one time at once.

This script will:
1.) Find line with leading dd:dd:dd,ddd
2.) Check if last non-blank sign of next line is a dot
3.) If not empty, get content of next line
4.) If dot was found above; replace first char to upper case, else to lower case


Redraw = false;
//we use a RegEx search pattern to match first time from strings like: "00:02:59,203 –> 00:03:01,906"
foundcount = document.selection.Find("^\\d\\d:\\d\\d:\\d\\d,\\d\\d\\d\\s",eeFindNext | eeFindReplaceRegExp);

if(foundcount){
	//if line starts with something like "00:02:59,203 ", then go one line down:
	document.selection.LineDown( );
	//get the last sign of thatline:
	LineContent = document.GetLine( document.selection.GetActivePointY(eePosLogical) );
	LineContent = LineContent.replace(/\s+$/,"");
	LastSign = LineContent.slice(-1);
	
	//go again one line down:
	document.selection.LineDown( );
	yPos = document.selection.GetActivePointY( eePosLogical );
	LineContent = document.GetLine( yPos );
	//if that line is not empty ("If a row of subtitle have 2 lines"):
	if(LineContent.length > 0){

		//if the last sign was a dot:
		if(LastSign=="."){
			//be sure first char is upper case:
			OUT = LineContent.slice(0,1).toUpperCase() + LineContent.slice(1);
		}else{
			//be sure first char is lower case:
			OUT = LineContent.slice(0,1).toLowerCase()+ LineContent.slice(1);
		}
	
		//replace origin line content:
		document.selection.SelectLine();
		document.selection.text = OUT + "\n";
	}
}
else
	alert("Search pattern not found.");
document.HighlightFind = false;

HTH?