IPB

Welcome Guest ( Log In | Register )

> Notice!

Please take a minute to check our Frequently Asked Questions. Use Search to reveal possible related topics.

Also make sure you've read the Forum Guidelines before posting in this forum.

 
Reply to this topicStart new topic
> Help writing an action, used to shorten the length of the track field
Purkinje
post Oct 11 2009, 04:54
Post #1


Member


Group: Members
Posts: 4
Joined: 11-October 09
Member No.: 11073
Mp3tag Version: 2.44



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.

This post has been edited by Purkinje: Oct 11 2009, 06:11
Go to the top of the page
 
+Quote Post
DetlevD
post Oct 11 2009, 08:58
Post #2


Member


Group: Full Members
Posts: 4907
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.63



QUOTE (Purkinje @ Oct 11 2009, 05:54) *
... 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. ... Example: Track: 009. After running the action, it would then become: Track: 9.

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


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
Purkinje
post Oct 11 2009, 16:06
Post #3


Member


Group: Members
Posts: 4
Joined: 11-October 09
Member No.: 11073
Mp3tag Version: 2.44



QUOTE (DetlevD @ Oct 11 2009, 01:58) *
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


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).
Go to the top of the page
 
+Quote Post
DetlevD
post Oct 11 2009, 17:11
Post #4


Member


Group: Full Members
Posts: 4907
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.63



QUOTE (Purkinje @ Oct 11 2009, 17:06) *
... When I use $num(%track,0), it just converts 09 to 0. ...

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

QUOTE (Purkinje @ Oct 11 2009, 17:06) *
... 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).

I do not understand what you want to do.

DD.20091011.1811.CEST


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post
Purkinje
post Oct 25 2009, 00:55
Post #5


Member


Group: Members
Posts: 4
Joined: 11-October 09
Member No.: 11073
Mp3tag Version: 2.44



QUOTE (DetlevD @ Oct 11 2009, 10:11) *
Yes this does it for me too.
See above example again.


I do not understand what you want to do.

DD.20091011.1811.CEST


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

Thanks for the replies, mate.
Go to the top of the page
 
+Quote Post
DetlevD
post Oct 25 2009, 08:50
Post #6


Member


Group: Full Members
Posts: 4907
Joined: 26-May 06
From: Wuppertal, Germany, Planet Earth
Member No.: 3194
Mp3tag Version: 2.63



QUOTE (Purkinje @ Oct 25 2009, 01:55) *
In the end, I just settled for the simpler action. Thanks for the replies, mate.

Well, but I have to add ...
... regarding your part of scripting ...
QUOTE
QUOTE (Purkinje @ Oct 11 2009, 17:06)
... When I use $num(%track,0), it just converts 09 to 0. ...

... 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


--------------------
* Beyond that, don't ask, when you don't know what to do with the answer. *
♥ home is where the heart is ♥
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 1st September 2014 - 14:41