Help writing an action


#1

Hello all, I’m new to this forum. I’m trying to write an action with these really nifty scripting commands in Mp3tag v2.44.

Basically, what I want it to do is detect if the track value is less than 10 (through an if statement?), and if that’s true, to take the right most digit in that track value and truncate all numbers to left of it.

I’m very new to the syntax of this scripting language, but I do know some basic-intermediate programming in Java.

Example:

Track: 009.

After running the action, it would then become:

Track: 9.

My thinking was for,
$if(%track% < 10 “and” $len(%track%) > 1, %mod(%track%, 10), “return %track% but I don’t what the syntax is for this part”)

You get the idea? Please ask for some elaboration from me if I haven’t explained myself completely, as I will be happy to give more info!

Thanks.


#2

You have asked a constantly asked question that can be answered quickly and easily.
The help file should offer a particular example for this case.

You can reach your goal by using the scripting function $num(x,y), e. g. $num(%track%,0), which eliminates all leading zeroes from the track number.

DD.20091011.0958


#3

Thanks for the reply.

When I use $num(%track,0), it just converts 09 to 0. However, I tried using my $mod(%track%,10) idea, and that works for numbers that are two digits long.

What I would like to do is probably more complicated than necessary, though. I wanted to be able to highlight all of songs, and have the action detect which ones need to be fixed (via the if method).

I don’t even know if that’s possible (or plausible).


#4

Yes this does it for me too.
See above example again.

I do not understand what you want to do.

DD.20091011.1811.CEST


#5

In the end, I just settled for the simpler action.

Thanks for the replies, mate.


#6

Well, but I have to add …
… regarding your part of scripting …

… that your problem was probably the fact, that you might have not detect your spelling error on the TRACK placeholder, which should be spelled correctly %TRACK%.

“$num(%track%,0)” is the easiest way to eliminate all leading zeroes from the track number.

DD.20091025.0848.CET