# Using TAG in actions/combining actions for different tags

**URL:** <https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419>\
**Category:** Support\
**Created:** [July 21, 2018, 8:05am UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419 "2018-07-21T08:05:06Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 25, 2018, 7:30am UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/21 "2018-07-25T07:30:57Z")

</div>

> [@sheepdisease](#):
>
> $REPLACE('%ALBUM% === %\_DIRECTORY% === %\_FILENAME%',' (ALBUM)') %ALBUM% === %\_DIRECTORY% === %\_FILENAME%

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.  
$REPLACE('%ALBUM% === %\_DIRECTORY% === %\_FILENAME%',' (ALBUM)',)

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 25, 2018, 2:12pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/22 "2018-07-25T14:12:23Z")

</div>

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%

```

Me  
Remove ' (Album)'

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

```

Can you see a problem with that?

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 25, 2018, 5:11pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/23 "2018-07-25T17:11:47Z")

</div>

> [@sheepdisease](#):
>
> Remove ' (Album)'
> 
> ```auto
> 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.

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 25, 2018, 6:00pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/24 "2018-07-25T18:00:22Z")

</div>

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](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/13?u=sheepdisease).

 ![image](https://community.mp3tag.de/uploads/default/original/2X/e/e443a531cdbb4251af698d29d82d551033b7cc56.png)

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

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 25, 2018, 6:16pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/25 "2018-07-25T18:16:52Z")

</div>

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

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

```

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?

 ![image](https://community.mp3tag.de/uploads/default/original/2X/0/0ebba59bda9b579eec74de2d8395c9886a4ad1d7.png)

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

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 25, 2018, 6:23pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/26 "2018-07-25T18:23:40Z")

</div>

> [@sheepdisease](#):
>
> I could have added another comma

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

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 25, 2018, 6:30pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/27 "2018-07-25T18:30:26Z")

</div>

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

The results of removing:

 ![image](https://community.mp3tag.de/uploads/default/original/2X/1/12683b928d73a6599fae2b13de346bcd649b880e.png)

```
$REPLACE(%ALBUM%===%_DIRECTORY%===%_FILENAME%,' (ALBUM)',)
%album%===%_directory%===%_filename%

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

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 25, 2018, 6:33pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/28 "2018-07-25T18:33:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 25, 2018, 6:36pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/29 "2018-07-25T18:36:03Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 25, 2018, 6:39pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/30 "2018-07-25T18:39:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 25, 2018, 6:45pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/31 "2018-07-25T18:45:09Z")

</div>

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.

 ![image](https://community.mp3tag.de/uploads/default/original/2X/0/06c40363a7ad58febd3c5ea9fa7fa80c65d263d1.png)

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 25, 2018, 6:49pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/32 "2018-07-25T18:49:21Z")

</div>

> [@sheepdisease](#):
>
> I explained in my last post that the tag \> tag field does not allow lower case to be typed.

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)`

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 25, 2018, 6:50pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/33 "2018-07-25T18:50:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 25, 2018, 6:54pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/34 "2018-07-25T18:54:57Z")

</div>

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

![image](https://community.mp3tag.de/uploads/default/original/2X/2/2423718fb1384a4cf209104c460d58e5e9075e98.png)

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

%ALBUM% === %_DIRECTORY% === %_FILENAME%

```

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:

![image](https://community.mp3tag.de/uploads/default/original/2X/0/06137b317564c640684bc8b7600b21ed02ed6797.png)

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 25, 2018, 7:09pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/35 "2018-07-25T19:09:38Z")

</div>

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"

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 25, 2018, 7:11pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/36 "2018-07-25T19:11:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 25, 2018, 7:29pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/37 "2018-07-25T19:29:59Z")

</div>

Okay, here goes:

 ![example](https://community.mp3tag.de/uploads/default/original/2X/a/a7c1140f8039e87f4e0659a804370e4cc7641aa5.gif)

---

<div class="post-metadata">

**Author:** ![ryerman](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ryerman/32/5285_2.png) [@ryerman](https://community.mp3tag.de/u/ryerman)\
**Post date:** [July 25, 2018, 8:17pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/38 "2018-07-25T20:17:40Z")

</div>

> [@sheepdisease](#):
>
> 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

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.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [July 25, 2018, 8:45pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/39 "2018-07-25T20:45:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [July 25, 2018, 9:32pm UTC](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419/40 "2018-07-25T21:32:03Z")

</div>

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?

[Previous page](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419.md?page=1)

[Next page](https://community.mp3tag.de/t/using-tag-in-actions-combining-actions-for-different-tags/42419.md?page=3)
