# IF THEN ELSE logic in Actions

**URL:** <https://community.mp3tag.de/t/if-then-else-logic-in-actions/51722>\
**Category:** Support\
**Created:** [January 25, 2021, 8:52am UTC](https://community.mp3tag.de/t/if-then-else-logic-in-actions/51722 "2021-01-25T08:52:07Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ammalena](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ammalena/32/8542_2.png) [@ammalena](https://community.mp3tag.de/u/ammalena)\
**Post date:** [January 25, 2021, 8:52am UTC](https://community.mp3tag.de/t/if-then-else-logic-in-actions/51722/1 "2021-01-25T08:52:07Z")

</div>

I believe this does not exist, but wanted to be sure....

Is there "iF THEN ELSE" logic available in actions?

**Ex:** IF %file.jpg% exists THEN ((do an action)) ELSE ((do another action))

_Related:_ Is it possible to move an Action group to a script, so the Actions can be extended using scripting?

---

<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:** [January 25, 2021, 8:58am UTC](https://community.mp3tag.de/t/if-then-else-logic-in-actions/51722/2 "2021-01-25T08:58:13Z")

</div>

See the help on Scripting:

> **[Scripting Functions – Mp3tag Documentation](https://docs.mp3tag.de/scripting/#boolean-functions)**
>
> Documentation on Mp3tag's scripting functions. Mp3tag is the universal Tag Editor.

There are several $if() functions that all have an ELSE branch.  
There is no function to test if an external file exists, MP3tag treats the currently loaded and selected files.

You cannot call an action group with a scripting command but there are many equivalents for actions mapped to scripting functions.  
Usually, it is the other way round: you execute an action that uses scripting functions.

---

<div class="post-metadata">

**Author:** ![ammalena](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ammalena/32/8542_2.png) [@ammalena](https://community.mp3tag.de/u/ammalena)\
**Post date:** [January 25, 2021, 9:11am UTC](https://community.mp3tag.de/t/if-then-else-logic-in-actions/51722/3 "2021-01-25T09:11:12Z")

</div>

So to be clear: If I have SOME files for adding album art (stored as ARTIST.JPG naming scheme), I cannot do a function to say " **IF artist.jpg exists, INSERT artist.jpg, ELSE insert "missing.jpg**" ...?

---

<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:** [January 25, 2021, 9:15am UTC](https://community.mp3tag.de/t/if-then-else-logic-in-actions/51722/4 "2021-01-25T09:15:36Z")

</div>

Yes, there is no way to find out if an external file exists.  
But ... if you have either the file artist.jpg in the folder or the file missing.jpg, then you could run an action to import the picture with  
Format string `*.jpg`  
This would import the first file that is found.  
And as "a" sorts before "m", you would get artist.jpg where it exists.  
And for all other cases you could filter for the number of embedded covers or where the cover is still missing  
%\_covers% MISSING

---

<div class="post-metadata">

**Author:** ![ammalena](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ammalena/32/8542_2.png) [@ammalena](https://community.mp3tag.de/u/ammalena)\
**Post date:** [January 25, 2021, 9:17am UTC](https://community.mp3tag.de/t/if-then-else-logic-in-actions/51722/5 "2021-01-25T09:17:34Z")

</div>

I have a workaround that will "work", thanks. I do not store my MP3s in album folders. My workaround would be to run "add MISSING.JPG" to all MP3s... then, run the real Action, which adds ARTIST.JPG to the MP3s. Those that have no ARTIST.JPG, should "leave the MiSSING" graphic in the tag.

---

<div class="post-metadata">

**Author:** ![ammalena](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ammalena/32/8542_2.png) [@ammalena](https://community.mp3tag.de/u/ammalena)\
**Post date:** [January 25, 2021, 9:18am UTC](https://community.mp3tag.de/t/if-then-else-logic-in-actions/51722/6 "2021-01-25T09:18:16Z")

</div>

I wanted the same Logic for LYRIC text files. (shrug)

---

<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:** [January 25, 2021, 9:23am UTC](https://community.mp3tag.de/t/if-then-else-logic-in-actions/51722/7 "2021-01-25T09:23:28Z")

</div>

I don't know how this scheme is part of a workflow.  
But: it is much easier to filter for missing covers than for a cover that shows "Missing".  
So: if you import covers with the format string %artist%.jpg you will probably get a number of error messages that the file does not exist. You would have to acknowledge those.  
But then you could filter for the files that still have no cover and see how to treat these.  
Something similar would apply to the lyrics files.

---

<div class="post-metadata">

**Author:** ![ammalena](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ammalena/32/8542_2.png) [@ammalena](https://community.mp3tag.de/u/ammalena)\
**Post date:** [January 25, 2021, 9:26am UTC](https://community.mp3tag.de/t/if-then-else-logic-in-actions/51722/8 "2021-01-25T09:26:14Z")

</div>

Agreed, using COVER. I am unclear how you'd do that for LYRICs. Also, if there was a preexisting COVER, this would not help... unless I REMOVED cover prior to adding one.

---

<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:** [January 25, 2021, 12:48pm UTC](https://community.mp3tag.de/t/if-then-else-logic-in-actions/51722/9 "2021-01-25T12:48:43Z")

</div>

> [@ammalena](#):
>
> Also, if there was a preexisting COVER, this would not help

You could filter for files that already have a cover and even if the cover type is already ARTIST.  
Or the other way round: with  
%\_covers% MISSING  
you would see the files that are in need of a picture.  
THe thing with the lyrics ... the lyrics file would have to comply with the rules to import data from a text file, probably via the action "Import text file".

---

<div class="post-metadata">

**Author:** ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)\
**Post date:** [January 25, 2021, 3:51pm UTC](https://community.mp3tag.de/t/if-then-else-logic-in-actions/51722/10 "2021-01-25T15:51:47Z")

</div>

> [@ammalena](#):
>
> Also, if there was a preexisting COVER, this would not help... unless I REMOVED cover prior to adding one.

You also have an option with this action-type to delete preexisting covers while importing them.

---

<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:29pm UTC](https://community.mp3tag.de/t/if-then-else-logic-in-actions/51722/11 "2026-02-09T12:29:01Z")

</div>


