# Variable (Temporary Tag?) within Action?

**URL:** https://community.mp3tag.de/t/variable-temporary-tag-within-action/67354
**Category:** Mac
**Created:** [February 1, 2025, 5:50pm UTC](https://community.mp3tag.de/t/variable-temporary-tag-within-action/67354 "2025-02-01T17:50:48Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![josephzitt](https://community.mp3tag.de/user_avatar/community.mp3tag.de/josephzitt/32/9533_2.png) [@josephzitt](https://community.mp3tag.de/u/josephzitt)
#### Post date: [February 1, 2025, 5:50pm UTC](https://community.mp3tag.de/t/variable-temporary-tag-within-action/67354/1 "2025-02-01T17:50:48Z")

</div>

I'm using Mp3tag for Mac, but I think it's relevant for other platforms. I have read the relevant documentation.

I have a regular expression that shows up in several format strings within an action that I have defined. Is it possible to define a temporary variable as that value in one of the first items, then use that variable later in the Action? This would remove the need to type the long regular expression repeatedly (and, of course, reduce the odds of mistyping it).

For example, I use the expression  
$if2(%ALBUMARTISTSORT%,%ALBUMARTIST%)  
to set \_DIRECTORY

I would like to use that value twice, to make a parent directory with the capitalized first letter of the result of that regex. (Why? Because Finder is choking on massive folder listings, like that for my artists folder.)

So I would like to be able to define a temporary tag FOO to hold the result of that expression, so I could use  
$left($caps3(%FOO%),1)/%FOO%/  
to place, say, an album by U2 in the folder U/U2/

Possible? Is it built in? I figured that I'd ask first, to avoid the possibility of breaking things.

---

<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: [February 1, 2025, 6:00pm UTC](https://community.mp3tag.de/t/variable-temporary-tag-within-action/67354/2 "2025-02-01T18:00:52Z")

</div>

I am not quite sure if I understand the problem correctly.  
I assume that you want to save the result of

> [@josephzitt](#):
>
> $if2(%ALBUMARTISTSORT%,%ALBUMARTIST%)

somewhere as you need that string for other purposes.

You could write the value to any tag field you like, even a user-defined one like e.g. MY\_ARTIST and use the contents of that field in other actions and action groups until you remove the field MY\_ARTIST again.

---

<div class="post-metadata">

### Author: ![josephzitt](https://community.mp3tag.de/user_avatar/community.mp3tag.de/josephzitt/32/9533_2.png) [@josephzitt](https://community.mp3tag.de/u/josephzitt)
#### Post date: [February 1, 2025, 6:43pm UTC](https://community.mp3tag.de/t/variable-temporary-tag-within-action/67354/3 "2025-02-01T18:43:17Z")

</div>

OK, to be sure I understand:

Can the tag name (in your example, MY\_ARTIST) be any arbitrary string?  
Would I think simply reference it as %MY\_ARTIST% ?  
Would it remain associated with the track after the action ends?

---

<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: [February 1, 2025, 6:46pm UTC](https://community.mp3tag.de/t/variable-temporary-tag-within-action/67354/4 "2025-02-01T18:46:59Z")

</div>

> [@josephzitt](#):
>
> be any arbitrary string?

Yes - it should not be the same as a reserved name for a standard tag field or a file property.

> [@josephzitt](#):
>
> Would I think simply reference it as %MY\_ARTIST% ?

Exactly.

> [@josephzitt](#):
>
> Would it remain associated with the track after the action ends?

The field is saved like any other (user-defined) field in the file - and stays there until the user (you?) explicitly deletes it.  
It is possible to remove a field (also this user-defined one) with an action that is part of the action group.

---

<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: [March 3, 2025, 6:47pm UTC](https://community.mp3tag.de/t/variable-temporary-tag-within-action/67354/5 "2025-03-03T18:47:31Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
