# text functions in Actions

**URL:** https://community.mp3tag.de/t/text-functions-in-actions/10600
**Category:** Support
**Created:** [June 29, 2010, 4:45pm UTC](https://community.mp3tag.de/t/text-functions-in-actions/10600 "2010-06-29T16:45:56Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![kaskeap](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/ea5d25/32.png) [@kaskeap](https://community.mp3tag.de/u/kaskeap)
#### Post date: [June 29, 2010, 4:45pm UTC](https://community.mp3tag.de/t/text-functions-in-actions/10600/1 "2010-06-29T16:45:56Z")

</div>

I'm just trying to get my head around MP3TAG, and probably asking a silly question, but after days of struggling to understand the examples so helpfully posted, I'm still baffled:

Here is an example of what I'm trying to do:

say I have music with the following filenames:

movement1Allegro.mp3  
movement2Andante.mp3  
movement3Adagio.mp3  
movement4Presto.mp3

and the corresponding TITLE tags:

track 01  
track 02  
track 03  
track 04

I want to change the TITLE tags to read

01 Allegro  
02 Andante  
03 Adagio  
04 Presto

So I try:

Action type: Format value  
Field: TITLE  
Formatstring: $right(%title%,2) $right(%filename%,(len(%filename%)-9))

But although a straight tag value in the Formatstring will return the contents of that tag, functions don't appear to work in Actions. How should I proceed?

Apologies if I use incorrect names for things, but I hope you understand what I'm driving at.

---

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [June 30, 2010, 12:48am UTC](https://community.mp3tag.de/t/text-functions-in-actions/10600/2 "2010-06-30T00:48:34Z")

</div>

A couple of questions first:

1. Do you have any other fields besides TITLE in the files? Specifically, is TRACK present and correct?

2. Are you sure you want/need the track number in the track's title? It's usually not necessary for an application to play the album in the correct order, _if_ the track number field is correct.

3. Do you also want to rename the files? In this case, you generally do want the track number in the filename, usually as the first component, so that the tracks appear in order when viewing the directory contents. I would probably use your proposed TITLE format for the filenames. E.g.

01 Allegro.mp3  
02 Andante.mp3  
03 Adagio.mp3  
04 Presto.mp3

```auto

Yes, functions work within Actions and format strings. There are two errors in your format string:

$right(%title%,2) $right(%filename%,(len(%filename%)-9))

1. There should be a $ sign before the 'len' function name, as with all functions.
2. %filename% should be %_filename%. "Special" field names are preceded by an underscore, as shown on this help page:

<a href="https://docs.mp3tag.de/converters" target="_blank">https://docs.mp3tag.de/converters</a>

```

Let's assume that the track number is _not_ present in the tags.

_Action type:_ **Format value**  
_Field:_ **TRACK**  
_Format string:_ **$mid(%\_filename%,9,1)**

Then get the TITLE with no track number:

_Action type:_ **Format value**  
_Field:_ **TITLE**  
_Format string:_ **$mid(%\_filename%,10,99)**

If you still want the track number in the title, use

_Action type:_ **Format value**  
_Field:_ **TITLE**  
_Format string:_ **$num(%track%,2) %title%**

And to rename the files as I suggested above, use the same format string on \_FILENAME:

_Action type:_ **Format value**  
_Field:_ **\_FILENAME**  
_Format string:_ **$num(%track%,2) %title%**

If you make the above an Action Group (multiple actions) be sure you don't execute it twice on your files or you'll screw things up pretty thoroughly.

---

<div class="post-metadata">

### Author: ![kaskeap](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/k/ea5d25/32.png) [@kaskeap](https://community.mp3tag.de/u/kaskeap)
#### Post date: [June 30, 2010, 3:19pm UTC](https://community.mp3tag.de/t/text-functions-in-actions/10600/3 "2010-06-30T15:19:30Z")

</div>

Thank you so much for your help. Sorry about typos leaving out $ signs etc, although actually I think I got them right when experimenting.

Of course your solution worked perfectly, so I don't know how came to believe I couldn't use functions in Actions -- I must have done something silly, and then been too discouraged to continue because I'd already found that if I try to introduce a function in the Action: Replace, then it seems to replace with the function description I entered instead of the function result I want. Is that what is meant to happen? And yes, I have Track numbers OK.

But anyway, when I tried functions in Format value as in your suggestion it worked (so goodness knows what I did wrong previously), and thanks again for your patience in providing such a full explanation.

I wanted the movement numbers in the titles just to show which movement out of a number of movements was playing, but if I could have programmed in multiple substitutes of I, II, III, IV for 01, 02, 03, that would be even better. Is that sort of thing possible with this arcane Regular Expressions stuff?

For some reason I have a particular problem with German software, in that I sometimes get the feeling that help files are written by people who utterly understand how their system works, but have forgotten what it's like to be a keen but clueless first time user. In the case of MP3TAG, they provide a perfect single representative example of each feature, but only one example per feature -- after all, why clutter up the help pages with more? Well, a bit of extra clutter in the form of 3 or 4 varied examples of the same feature would help a moron like me begin to discern patterns of use that reveal the underlying principles that the experts understand so well that they don't think there's anything TO understand... But then, the best German software is just so much better than the competition that a steep learning curve is worth following. For me and my colleagues, Samplitude, for instance, has been just miles ahead of all other audio applications for at least 6 years.

Anyway, sorry to rabbit on, and thanks again.

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 9, 2026, 12:22pm UTC](https://community.mp3tag.de/t/text-functions-in-actions/10600/4 "2026-02-09T12:22:28Z")

</div>


