:o Hello! I have a problem with a script. I have made an application to modify the colors of subtitles (.srt) in .avi files. The application works well, but I don't know how to avoid creating extra html tags.
This is the code:
myTable = TextFile.ReadToTable("AutoPlay\\Docs\\file.srt");
count = Table.Count(myTable);
for n = 1, count do
function myFunction()
inicio = String.Mid(myTable[n], 1, 1);
if inicio ~= "0" and inicio ~= "1" and inicio ~= "2" and inicio ~= "3" and inicio ~= "4" and inicio ~= "5" and inicio ~= "6" and inicio ~= "7" and inicio ~= "8" and inicio ~= "9" and inicio ~= "" then
x = myTable[n];
y = "<font color\=\"#"..colorcito.."\">"
w = "</font>"
z = y..x..w
result = Table.Remove(myTable, n);
Table.Insert(myTable, n, z);
TextFile.WriteFromTable("AutoPlay\\Docs\\file.srt" , myTable, false);
end
end
myFunction();
end
Page.ClickObject("Button1");
And what it does is this:
1
00:00:31,000 --> 00:00:34,151
<font color="#FFEC8B">People ask: Where do you get your ideas?</font>
2
00:00:34,790 --> 00:00:36,370
<font color="#FFEC8B">Well, right here. </font>
<font color="#FFEC8B">All this is my, Martian Landscape</font>
3
00:00:40,373 --> 00:00:42,983
<font color="#FFEC8B">somewhere in this room is an African Veldt</font>
<font color="#FFEC8B">just beyond, perhaps is a small</font>
<font color="#FFEC8B">Illionois town where I grew up</font>
VLC media player has no problem reading the html tags for the colors, and displays them colored subtitles perfectly. I just would like to eliminate those extra (not necessary) tags in red.
Thanks in advance!!!!!!
Santiago
This is the code:
myTable = TextFile.ReadToTable("AutoPlay\\Docs\\file.srt");
count = Table.Count(myTable);
for n = 1, count do
function myFunction()
inicio = String.Mid(myTable[n], 1, 1);
if inicio ~= "0" and inicio ~= "1" and inicio ~= "2" and inicio ~= "3" and inicio ~= "4" and inicio ~= "5" and inicio ~= "6" and inicio ~= "7" and inicio ~= "8" and inicio ~= "9" and inicio ~= "" then
x = myTable[n];
y = "<font color\=\"#"..colorcito.."\">"
w = "</font>"
z = y..x..w
result = Table.Remove(myTable, n);
Table.Insert(myTable, n, z);
TextFile.WriteFromTable("AutoPlay\\Docs\\file.srt" , myTable, false);
end
end
myFunction();
end
Page.ClickObject("Button1");
And what it does is this:
1
00:00:31,000 --> 00:00:34,151
<font color="#FFEC8B">People ask: Where do you get your ideas?</font>
2
00:00:34,790 --> 00:00:36,370
<font color="#FFEC8B">Well, right here. </font>
<font color="#FFEC8B">All this is my, Martian Landscape</font>
3
00:00:40,373 --> 00:00:42,983
<font color="#FFEC8B">somewhere in this room is an African Veldt</font>
<font color="#FFEC8B">just beyond, perhaps is a small</font>
<font color="#FFEC8B">Illionois town where I grew up</font>
VLC media player has no problem reading the html tags for the colors, and displays them colored subtitles perfectly. I just would like to eliminate those extra (not necessary) tags in red.
Thanks in advance!!!!!!
Santiago
Comment