happy new year everyone!
i spent my free time between christmas and new year trying to figure the following on ultraedit 12.10:
read block numbers from french subtitle file f.srt with incorrect timestamps
read timestamps from english subtitle file e.srt with correct timestamps
read french subtitles from f.srt
write all these into corrected file c.srt
there are either one or two lines of text per block and there aren't necessarily equal numbers of subtitle lines between french and english files. the original files had a CR (dec 13) between each block. there is over 300 blocks per file so doing it by hand gets excruciatingly tedious.
for example:
"f.srt" =
"
1
00:02:09,320 --> 00:02:11,197
Papa arrive.
2
00:02:13,280 --> 00:02:15,430
Ricane pas, tu vas tout gâcher.
3
00:02:15,640 --> 00:02:18,950
Il doit pas savoir que maman a payé
2 500 $ pour un portrait d'elle.
4
00:02:20,440 --> 00:02:22,749
Vraiment. Arrête.
5
00:02:26,480 --> 00:02:29,472
Bien. T'as laissé le prix dessus ?
6
00:02:29,680 --> 00:02:34,037
Non, vraiment, arrête.
Ça pourrait le tuer, tu sais.
7
00:02:36,200 --> 00:02:39,397
Attends. Bud, on n'a pas
une dette envers lui ?
"
AND
"e.srt" =
"
1
00:01:21,331 --> 00:01:23,250
Dad's coming. Dad's coming.
2
00:01:25,460 --> 00:01:27,671
Don't giggle. You'll give it away.
3
00:01:27,921 --> 00:01:31,341
He's not to know Mom commissioned
a painting of herself for $2500.
4
00:01:32,926 --> 00:01:35,304
Really. Don't.
5
00:01:39,224 --> 00:01:42,311
Okay, okay.
Did you leave the price tag on?
6
00:01:42,561 --> 00:01:47,065
No, really, really, don't.
This could kill him, you know.
7
00:01:49,359 --> 00:01:52,654
Wait. Bud, don't we have
a loyalty to the man?
"
SHOULD GIVE:
"c.srt" =
"
1
00:01:21,331 --> 00:01:23,250
Papa arrive.
2
00:01:25,460 --> 00:01:27,671
Ricane pas, tu vas tout gâcher.
3
00:01:27,921 --> 00:01:31,341
Il doit pas savoir que maman a payé
2 500 $ pour un portrait d'elle.
4
00:01:32,926 --> 00:01:35,304
Vraiment. Arrête.
5
00:01:39,224 --> 00:01:42,311
Bien. T'as laissé le prix dessus ?
6
00:01:42,561 --> 00:01:47,065
Non, vraiment, arrête.
Ça pourrait le tuer, tu sais.
7
00:01:49,359 --> 00:01:52,654
Attends. Bud, on n'a pas
une dette envers lui ?
with french file opened in the first tab, the english in the second and the corrected file starting empty in the third tab
the macro i came up with:
InsertMode
ColumnModeOff
HexOff
UnixReOff
Loop
SelectLine
Copy
NextDocument
Key DOWN ARROW
NextDocument
Paste
NextDocument
Key DOWN ARROW
NextDocument
SelectLine
Copy
Key DOWN ARROW
NextDocument
Paste
NextDocument
SelectLine
Copy
NextDocument
NextDocument
Paste
NextDocument
IfCharIs 13
Key DOWN ARROW
NextDocument
NextDocument
"
"
NextDocument
Else
SelectLine
Copy
Key DOWN ARROW
NextDocument
NextDocument
Paste
"
"
NextDocument
EndIf
NextDocument
IfCharIs 13
Key DOWN ARROW
NextDocument
NextDocument
Else
Key DOWN ARROW
Key DOWN ARROW
NextDocument
NextDocument
EndIf
EndLoop
works ok until half of the second block and since there seems to be no way to do a step by step execution of the macro, i have a hard time figuring where the behavior of the "if else" in it diverges from my expectations. not to mention that i tried a few places for the end of file test without any good results either. my coding experience dates back to fortran 25 years ago and it seemed a bit more explicit and had a larger instruction set than what is available in ultraedit but i believe it is possible to solve this with ultraedit, it's likely just that i don't have a deep enough feel or time to cinch it.
can anyone tell me how to fix this macro?
any help will be appreciated.
i spent my free time between christmas and new year trying to figure the following on ultraedit 12.10:
read block numbers from french subtitle file f.srt with incorrect timestamps
read timestamps from english subtitle file e.srt with correct timestamps
read french subtitles from f.srt
write all these into corrected file c.srt
there are either one or two lines of text per block and there aren't necessarily equal numbers of subtitle lines between french and english files. the original files had a CR (dec 13) between each block. there is over 300 blocks per file so doing it by hand gets excruciatingly tedious.
for example:
"f.srt" =
"
1
00:02:09,320 --> 00:02:11,197
Papa arrive.
2
00:02:13,280 --> 00:02:15,430
Ricane pas, tu vas tout gâcher.
3
00:02:15,640 --> 00:02:18,950
Il doit pas savoir que maman a payé
2 500 $ pour un portrait d'elle.
4
00:02:20,440 --> 00:02:22,749
Vraiment. Arrête.
5
00:02:26,480 --> 00:02:29,472
Bien. T'as laissé le prix dessus ?
6
00:02:29,680 --> 00:02:34,037
Non, vraiment, arrête.
Ça pourrait le tuer, tu sais.
7
00:02:36,200 --> 00:02:39,397
Attends. Bud, on n'a pas
une dette envers lui ?
"
AND
"e.srt" =
"
1
00:01:21,331 --> 00:01:23,250
Dad's coming. Dad's coming.
2
00:01:25,460 --> 00:01:27,671
Don't giggle. You'll give it away.
3
00:01:27,921 --> 00:01:31,341
He's not to know Mom commissioned
a painting of herself for $2500.
4
00:01:32,926 --> 00:01:35,304
Really. Don't.
5
00:01:39,224 --> 00:01:42,311
Okay, okay.
Did you leave the price tag on?
6
00:01:42,561 --> 00:01:47,065
No, really, really, don't.
This could kill him, you know.
7
00:01:49,359 --> 00:01:52,654
Wait. Bud, don't we have
a loyalty to the man?
"
SHOULD GIVE:
"c.srt" =
"
1
00:01:21,331 --> 00:01:23,250
Papa arrive.
2
00:01:25,460 --> 00:01:27,671
Ricane pas, tu vas tout gâcher.
3
00:01:27,921 --> 00:01:31,341
Il doit pas savoir que maman a payé
2 500 $ pour un portrait d'elle.
4
00:01:32,926 --> 00:01:35,304
Vraiment. Arrête.
5
00:01:39,224 --> 00:01:42,311
Bien. T'as laissé le prix dessus ?
6
00:01:42,561 --> 00:01:47,065
Non, vraiment, arrête.
Ça pourrait le tuer, tu sais.
7
00:01:49,359 --> 00:01:52,654
Attends. Bud, on n'a pas
une dette envers lui ?
with french file opened in the first tab, the english in the second and the corrected file starting empty in the third tab
the macro i came up with:
InsertMode
ColumnModeOff
HexOff
UnixReOff
Loop
SelectLine
Copy
NextDocument
Key DOWN ARROW
NextDocument
Paste
NextDocument
Key DOWN ARROW
NextDocument
SelectLine
Copy
Key DOWN ARROW
NextDocument
Paste
NextDocument
SelectLine
Copy
NextDocument
NextDocument
Paste
NextDocument
IfCharIs 13
Key DOWN ARROW
NextDocument
NextDocument
"
"
NextDocument
Else
SelectLine
Copy
Key DOWN ARROW
NextDocument
NextDocument
Paste
"
"
NextDocument
EndIf
NextDocument
IfCharIs 13
Key DOWN ARROW
NextDocument
NextDocument
Else
Key DOWN ARROW
Key DOWN ARROW
NextDocument
NextDocument
EndIf
EndLoop
works ok until half of the second block and since there seems to be no way to do a step by step execution of the macro, i have a hard time figuring where the behavior of the "if else" in it diverges from my expectations. not to mention that i tried a few places for the end of file test without any good results either. my coding experience dates back to fortran 25 years ago and it seemed a bit more explicit and had a larger instruction set than what is available in ultraedit but i believe it is possible to solve this with ultraedit, it's likely just that i don't have a deep enough feel or time to cinch it.
can anyone tell me how to fix this macro?
any help will be appreciated.