How to use existing tag value in script?

I suspect based on some other threads that this is not possible, but am I able to create a script that will copy the EXISTING value of the date tag to a new custom tag before overwriting the date tag with %date% from MBZ?

No, that’s currently not possible with scripting. While a tag will have the value from the file if it is not filled from MB, the MB value will hide the value from the file in scripting.

1 Like

That’s too bad, but thank you for your response. What about a way to preserve the existing tag if it exists, but overwrite it if not?

The specific situation I am trying to resolve is this:

I have much of my music tagged with dates based on when the song was originally released. I would like to create a script that places information from %_recording_firstreleasedate% into the date tag, but ONLY if the date tag is empty. When I create a script that says


It seems to override the “Preserve Tags” list and populate the new information into the date tag regardless of what’s in there.

What about this script:


I’m not 100% sure and you need to test. But I think %date% will have the original value in the script if you have “date” set as preserved. $if2 returns the first non-empty value.

We really should allow for a way to access the file data, though. There is an open ticket for this.


Yep. That worked. I was thinking %date% would overwrite with the MB date data, but that one does actually respect the preserve tags list.

I spoke too soon. That script ends up preserving if it exists, but placing the %date% value if it’s empty as long as there is a %date% value…which there is 99% of the time. So it basically never places the %_recording_firstreleasedate% value I’m wanting.

But this seems to work:


I’m not entirely sure why the if2 makes a difference in this respect.