Conditional Export

I can't determine why there aren't more questions like mine, but I hope it's not because I am a total bonehead.

I want to create a simple flat text export that exports different information based on what's in the tag.

After struggling I managed to create an export consisting of a unique list of Artist-Album combinations.

My latest quest is to export the comment tag only when it contains certain information, if it doesn't contain the specific text then I want to export blanks. I don't know where in the comment field my search target may appear.

If this is a stupid question then a pointer to "Scripting for Dummies" would be helpful.

You should write some concrete examples.
Why don't you attach your export file ("unique list of Artist-Album combinations") that you made?
Maybe I can help.

~ milka

Milka -

Thanks so much for your offer.

Here is the script that exports a unique list of Artist-Album (if there is %Album% to export). Is there a better way to do this?

$filename(txt)$loop(%artist%)$loop(%album%)$if($Eql(%album%,),,%artist%-%album%$char(13)$char(10))$loopend()$loopend()

I would like to write a different script that exports Artist-Title, but only if the Comment field contains the characters "R5". I can't determine any way to do that.

AFAIK a unique list do not have equal lines, so it sould be something like this: $filename(test.txt)$loop(%album%-%artist%,1)$if($neql(%album%,),%artist%-%album%

,)$loopend()

And the artist-title export:

$loop(%artist%-%title%)$if($eql($strstr(%comment%,R5),0),,%artist%-%title%
)$loopend()

Regards
nickless

I had some work to do, but nickless have done it. I test it and it's working nice.

~ milka

This is brilliant! You two are wonderful!

The examples have taught me several basic tricks and approaches I was missing. Character-based languages (APL, RegEx, etc.) require true subtlety to master.

I have finally gotten back to this task. In my testing the artist-title export does not work. The $strstr(%comment%,R5) function returns true when it finds just the letter R, it does not require finding the string "R5".

Can anyone confirm or deny this for me?

Maybe is some kind of a bug. Can I see your comment tag content?

OK, I guess I am a complete bonehead. I went back to retest the code to provide my results and everything works as I was hoping.

I apologize for the fire drill.

I would like to revive this thread with the following question:

The mentioned conditional export is static - could someone help me generate a conditional export that is based on the date?

My files have a special tag that designates the day I tagged them in the format YYYY-MM-DD. Now, if I run my export in September 2007 (using %_date% mp3tag generates M/DD/YYYY) I would like to only show those files that I tagged in September 2007, i.e. in which the special tag says 2007-09-XX. I would like this to work not only in that particular month but in any month.

In programming-lingo I would want:

Export files in which specialtag's first 7 digits (e.g.2007-09) equal current month.

Is there a way to do this? I am kind of a greenhorn with scripting and unfortunately stuck... .

Any help is greatly appreciated.

Thanks! :slight_smile:

$if($eql($replace($left(%your field%,7),-0,-),$regexp(%_date%,^(\d\d?)/\d\d?/(\d\d\d\d)$,$2-$1)),Yes,No)

In the Yes part goes the stuff you want to output if the condintion is fulfilled and No part stays empty.

Oh wow, thank you Dano, I will try this out right away!

Do you by any chance also know how I can limit the number of loops when I sort inversely using the $sub(%fieldofinterest%,10000000) method? MP3TAG always crashes when I put it this way:

$loop($sub(%fieldofinterest%),10000000000),50) <--instead of limiting it to 50 loops it just keeps on going OR crashes ... .

Thank you.

st