Determine the last loop inside loop?

Hi,

unfortunatly I do not know proper keywords for a search and maybe I'm somehow blind

Consider a loop over an album in order to export the tracklisting, something like $loop(%_filename_ext%) $num(%track%,2) -- %title%
$loopend  I'm trying to execute a command only in the last loop, e.g. $loop(%_filename_ext%)
$num(%track%,2) -- %title% IF this is the very last run of this loop, than do ... else nothing.$loopend


I tried %_max_counter%, %_total_files% and defined a variable (puts(condition, %_total_files%) ... But it does not work In my case it is not a solution, to put my commands after the loop.

(By the way, it was easy to determine the first loop: $if($eql(%_counter%,1),true,false).

Any help is appreciated. Regards, LosMintos

Can't you just write the text after the $loopend command? No, unfortenately not. Long answer: The export script creates a LaTeX file. The result is a catalogue of the hole CD collection. The tracklistings of the CDs are exported in a tabular environment. By my knowlegde neither supertabular nor longtable are compatible with LaTeX's twocolumn mode or with the multicol-package (e.g. the multicols environment). That's why I create per album several tabular environments each one with a single line listing one track. Between these tabular environments a column break can occur. The last track of a tracklisting (the last tabular) shall be followed by a \bottomrule command. The \end{tabular} is created inside the loop and the \bottomrule must occur before the \end{tabular} -- but only for the last track, e.g. the last item in a loop. $filename(%_workingdir%.tex)
$loop($replace(%artist%,&,\&),1)
$loop(%album%)$loop(%_filename_ext%)
\begin{tabularx}{\linewidth}{@{}r@{\quad}>{\raggedright\arraybackslash}X@{}r}$if($eql(%_counter%,1),\toprule,)
\num{$num(%track%,2)} &$replace($replace($replace($replace(%title%,&,\&),#,\#),",''),$,\$)\dotfill & %_length%\\\\ %%HERE \bottomrule INSIDE LAST ITEM OF LOOP \end{tabularx}$loopend()
$loopend()$loopend()


Maybe there is a better way in LaTeX to overcome the page break limitation? Or there is a way to determine the last item of a loop inside the loop.

Any hint?

Regards, LosMintos.

Yes, now I can. I modified all the stuff after MP3Tag (in this case: LaTeX commands).

The here asked question is somehow interesting (at least for me), but so far I'm not dependent on a solution.

QUOTE (LosMintos @ Sep 23 2008, 10:26) <{POST_SNAPBACK}>
... I'm trying to execute a command only in the last loop, e.g.
$loop(%_filename_ext%)$num(%track%,2) -- %title%
IF this is the very last run of this loop, than do ... else nothing.
$loopend  ... (By the way, it was easy to determine the first loop:$if($eql(%_counter%,1),true,false). Any help is appreciated. Regards, LosMintos Better late than never ... here is an example export script ...$filename($getEnv('USERPROFILE')'\Desktop\Export.Whatever.txt',UTF-8)$loop(%_path%)$puts(CountMax,%_counter%)$loopend() $loop(%_path%) 'Item: '%_counter%$if($eql($get(CountMax),%_counter%),' <-- Here is the last item.',) 'Path: '%_path% \$loopend()

Example output ...

Item: 1
Path: T:\TEST\File 01.mp3

Item: 2
Path: T:\TEST\File 02.mp3

Item: 3 <-- Here is the last item.
Path: T:\TEST\File 03.mp3


DD.20140301.1847.CET