Unexpected If-Then Behavior in an Export Loop

Three files attached:

  1. .mte (export config) file
  2. .txt export output file
  3. sample .mp3 files

I have titles formatted WW.LL Text ... where WW = week number and LL = lesson number (Coursera lectures)
I want to check these for numbering gaps.

I want to only show "missing" episodes when there's a gap in lesson numbers, not when a week changes. So in the sample .mp3 files below I would only show a missing episode at 04.04

Beatles - 03.06 She.mp3
Beatles - 03.07 Loves.mp3
Beatles - 03.08 Me.mp3
Beatles - 04.01 Yah.mp3
Beatles - 04.02 Nah.mp3
Beatles - 04.04 Blah.mp3
Beatles - 04.05 Ohhh.mp3

Below is the .mte file. The error comes in the first if statement ... $puts(LessonCount,$fmtNum($mid(%title%,4,2))) is getting invoked as though the if statement weren't even there ... both the TRUE and FALSE conditions of the if statement are being processed. LessonCount is being set to the current lesson number even when the week has not iterated.

$if($eql($get(LessonCount),$fmtNum($mid(%title%,4,2))),' OKAY: ','# Missing Track: '$puts(LessonCount,$fmtNum($mid(%title%,4,2)))) %album% %title%


__.___NumberingGaps.mte (834 Bytes)

Numbering_Gaps.txt (248 Bytes)

Beatles.rar (136 KB)

Have a look there ...
Export, $Puts() is executed always
You have to modify the $if statements, because $put/$puts does not work within $if expression.


Thanks. Your assistance in this forum has been exemplary.

Your answer is not fully correct, and I supply a clarification for future forum readers.

You can use $puts within an $if statement, just not more than one at a time. Below is a functioning example.

This Export configuration code finds numbering gaps across multiple albums with titles of the format '##.## text'

$if($or($eql($fmtNum($mid(%title%,4,2)),$get(LessonCount)),$neql($fmtNum($left(%title%,2)),$get(LastWeek))),' OKAY: ','# Missing Track: '$puts(LessonCount,$mid(%title%,4,2)))
$puts(LastWeek,$fmtNum($left(%title%,2)))%album% %title%


Thanks for the info ... I will have a look into.
Maybe in the meantime there was a silent error repair in the Mp3tag export scripting language?

BTW ... instead of "$fmtNum($mid(%title%,4,2)" ...
you may use "$num($mid(%title%,4,2),1)"


I went to clone the above export configuration for other purposes and discovered that the statement: $puts(LessonCount,$mid(%title%,4,2)) could just as well have been outside the if-then loop. The above export configuration still works for its original intention (finding gaps), but the $puts gets fired off every iteration of the loop whether or not the if-then condition is met.

... so for now the moderator's original feedback stands:

you cannot use $puts within the conditionals of an if-then.

Sorry for any confusion.