|
Post by aeronnaex on Nov 22, 2022 17:12:51 GMT
I'm processing sound files and the macro is working great.....one at a time.....except I've got a LOT of files to process. So I've got two text files: SOURCE.TXT and TARGET.TXT. In the macro I use %STRING1% for the SOURCE file name (per line from SOURCE.TXT), and %STRING2% for the TARGET file name (per line from TARGET.TXT). The problem is when I use a FOR like this:
1 | FOR | EACH | LINE IN | D:\SourceTEST.txt | RUN
2 | RUN ACTION | DEFINE STRING VARIABLE | %STRING1%::%LINE%
3 | FOR | EACH | LINE IN | D:\TargetTEST.txt | RUN
4 | RUN ACTION | DEFINE STRING VARIABLE | %STRING2%::%LINE%
........PROCESSING LINES HERE
5 | FOR | NEXT |LOOP 5
The problem is, as I run a loop, it uses the same two strings for %STRING1% and %STRING2% - it's not loading the next lines in either file.
Help!
|
|
|
Post by stevenm on Nov 22, 2022 18:12:51 GMT
Without testing this myself, i think your problem is one of using the same variable in the for loop... >>> LINE <<<
Changing LINE to SRCLINE and TGTLINE like below should likely fix the issue... as the macro likely overwrites LINE in the second FOR loop.
1 | FOR | EACH | SRCLINE IN | D:\SourceTEST.txt | DO
2 | RUN ACTION | DEFINE STRING VARIABLE | %STRING1%::%SRCLINE%
3 | FOR | EACH | TGTLINE IN | D:\TargetTEST.txt | DO
4 | RUN ACTION | DEFINE STRING VARIABLE | %STRING2%::%TGTLINE%
5 | FOR | NEXT HTH
Steven M
|
|
|
Post by aeronnaex on Nov 22, 2022 18:45:26 GMT
Without testing this myself, i think your problem is one of using the same variable in the for loop... >>> LINE <<< Changing LINE to SRCLINE and TGTLINE like below should likely fix the issue... as the macro likely overwrites LINE in the second FOR loop. 1 | FOR | EACH | SRCLINE IN | D:\SourceTEST.txt | DO
2 | RUN ACTION | DEFINE STRING VARIABLE | %STRING1%::%SRCLINE%
3 | FOR | EACH | TGTLINE IN | D:\TargetTEST.txt | DO
4 | RUN ACTION | DEFINE STRING VARIABLE | %STRING2%::%TGTLINE%
5 | FOR | NEXT HTH Steven M Actually, %STRING1% and %STRING2% are two different values, and are correct for the first line of their respective files. It just doesn't set them to the next line in those files when the loop starts the next cycle (and it does start the next cycle successfully). I have "Clear Variables On Playback" disabled.
|
|
|
Post by aeronnaex on Nov 22, 2022 21:38:29 GMT
I've got the context for loading from two files, but the variables %SOURCE% and %TARGET% never move down the list, even after a FOR|NEXT. 1 | FOR | EACH | LINE IN | D:\SourceTEST.txt | DO 6 | RUN ACTION | INPUT FROM FILE | SOURCE::NO_REFRESH: :\SourceTEST.txt 5 | RUN ACTION | INPUT FROM FILE | TARGET::NO_REFRESH: :\TargetTEST.txt The variables through the first two loops look like this - they don't change, although clearly MMM has some knowledge of the other values for each: %SOURCE%=source1 source2 source3 source4 source5 %TARGET%=target1 target2 target3 target4 target5
|
|