Using TAG in actions/combining actions for different tags

You do not enter a replace string. You have supplied a data string, a search string but no string what to do with what the function found. It is simply a syntax error.

Thanks for your reply.

I am not at home to test this but hope it works for me.

To summarise:

Original: ohrenkino

Source: $replace('%title% === %ALBUM%','[','(',']',')')
Target: %title% === %album%

Tested: Me (Not working)

Source: $replace('%ALBUM% === %_DIRECTORY% === %_FILENAME%',' (Album)'
Guessing pattern: %ALBUM% === %_DIRECTORY% === %_FILENAME%

Proposed: LaurenBacall
Replace square brackets

Source format: $replace(%title%===%album%===%artist%,'[','(',']',')')
Guessing pattern: %title%===%album%===%artist%

Remove ' (Album)'

Source format: $replace(%album%===%_directory%===%_filename%,' (Album)')
Guessing pattern: %album%===%_directory%===%_filename%

Can you see a problem with that?

Again: the source has the already mentioned syntax error of no "replace with" part.
And again the advice: you can test these expressions with the function Convert>Tag-Tag
Try it there first please.

I can see that you have highlighted ' (Album)' but I still don't understand why it isn't right when it is converted from the code given by Lauren, which apparently works?

$replace is right at the beginning, how can it be missing?

As you can see from my previous screenshots in post 13 I have been testing in convert tag > tag Using TAG in actions/combining actions for different tags.

The preview should show 'Kick' without ' (Album)' in the example.

My only observation by comparison is that I could have added another comma but the result isn't any different?


So, to break this down, we are instructing mp3tag to find album, directory and filename and within those tags any instances of ' (Album)'. Does it need another comma like in my example followed by '' to tell it to replace with that?

A:\Music\Record\INXS\Kick (Album)\1 Guns in the Sky.mp3
  "" ->
  "Kick (Album)===Kick (Album)===1 Guns in the Sky"

Yes, if you had added only that ... but you have also added 2 apostrophes.
What happens, if you leave them out?

I thought that as there are apostrophes around ' (Album)' I would have to do the same for any replacement.

The results of removing:


A:\Music\Record\INXS\Kick (Album)\1 Guns in the Sky.mp3
  "" ->
  "Kick (Album)===Kick (Album)===1 Guns in the Sky"

The case of "(ALBUM)" does not match the case in the source string.

When typing in the convert tag > tag it does not allow lower case in field. So the case of the source file must match exactly that of the field? If so, how are you supposed to properly test anything using Tag > Tag and implement such code?

The string " (ALBUM)" that you use to be looked for in
A:\Music\Record\INXS\Kick (Album)\1 Guns in the Sky.mp3
does not match the case of "(Album)".

So within tag > tag the code is case sensitive? If so, I explained in my last post that the tag > tag field does not allow lower case to be typed.

Out of interest I tested the code on an actual file within an action and it replaced every instance of ' (Album)' except in the directory path for some reason. I thought that directory and path were the same thing.

I just tried it and cannot verify this behaviour:
$replace('A:\Music\Record\INXS\Kick (Album)\1 Guns in the Sky.mp3',(Album),) -> A:\Music\Record\INXS\Kick\1 Guns in the Sky.mp3)

Actually, I just refreshed and the file reverts back to its original state afterwards. Not sure what is going on.

Unlike in tag > tag converter, in proper actions you can specify the case of code:


$REPLACE(%ALBUM% === %_DIRECTORY% === %_FILENAME%,' (Album)',)


According to your previous posts this is the correct code as far as you are concerned?

When I run it, it produces the outcome I showed in my other screenshot (suggesting it has made some changes with some instances of ' (Album)' being removed), but at the same time suggests an error:


Does it show the expected output or not?
If it is, then I would keep it with David Farragut: "Damn the torpedoes, full speed ahead"

Like I said, it shows the result expected for all but the 'directory/path'. However, when I refresh mp3tag it changes back suggesting it never really made the changes, as supported by the message in my previous screenshot above.

I'm installing a gif recorder to show you what I mean.

Okay, here goes:

The lesson here is that "Guess values" does not rename the directory.
It looks like it does, but it doesn't.
Maybe that's a bug: I won't make a bug report.

However, "Format value" will rename the directory.
I can't think of a way to use "Format value" to modify more than 1 field within the same action.

user @sheepdisease knows that an action to modify the folder has to be in its own action group.

The examples I supplied did not mention filename or directory for "guess value".

Even though it is possible to (mis-)use "guess value" to work on several fields in one action I still think that code is much easier to be maintained if there is just one target field.
The "Copy action" function, BTW, should make it much easier to get correct code than the rather complex application with "guess value".
THis is especially true as @sheepdisease seems to have some problems to follow syntax examples or apply concrete hints on syntax errors.
I would suggest a deep revision of the workflow and see if the applied action or selection of actions actually serves the purpose.

After removing the code referring to directory it seems that was indeed the problem.

The main purpose of the original post was to reduce the number of lines within actions. Even if that is just for changing brackets and a number of other functions then the code will serve its purpose.

Surely if the program indicates that something has changed when it hasn't, that is a bug?