# Script: track number and title on Mac

**URL:** <https://community.metabrainz.org/t/script-track-number-and-title-on-mac/381825>\
**Category:** MusicBrainz Picard\
**Tags:** picard\
**Created:** [May 23, 2018, 3:38pm UTC](https://community.metabrainz.org/t/script-track-number-and-title-on-mac/381825 "2018-05-23T15:38:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rakader](https://community.metabrainz.org/letter_avatar_proxy/v4/letter/r/f4b2a3/32.png) [@rakader](https://community.metabrainz.org/u/rakader)\
**Post date:** [May 23, 2018, 3:38pm UTC](https://community.metabrainz.org/t/script-track-number-and-title-on-mac/381825/1 "2018-05-23T15:38:24Z")

</div>

Hi,

what is the correct string for a script that ad a number with leading zero to a title if the number is missing?

Every title should look like this: 01 Music Title.[suffix]  
I tried it with several solutions here from the forum, but without result. Never a number is added to the file.

The script in preferences is too complicated for me. I’m not able to develope my own solution:

```auto
$if2(%albumartist%,%artist%)/$if($ne(%albumartist%,),%album%/)$if($gt(%totaldiscs%,1),%discnumber%-,)$if($ne(%albumartist%,),$num(%tracknumber%,2) ,)$if(%_multiartist%,%artist% - ,)%title%

```

Could anybody help me?

Thank you  
Radulph

---

<div class="post-metadata">

**Author:** ![outsidecontext](https://community.metabrainz.org/user_avatar/community.metabrainz.org/outsidecontext/32/90_2.png) [@outsidecontext](https://community.metabrainz.org/u/outsidecontext)\
**Post date:** [May 23, 2018, 4:07pm UTC](https://community.metabrainz.org/t/script-track-number-and-title-on-mac/381825/2 "2018-05-23T16:07:53Z")

</div>

Actually the `$num(%tracknumber%,2)` in your script should already do it. In what cases exactly is this not working? Do you save files matched against MusicBrainz metadata in the right most pane, or are you saving just files in the left pane?

Maybe remove the surrounding `$if`, by default the track number is only added if there is an albumartist (which should be the case unless you tag a non-album track). The script will be this then:

```auto
$if2(%albumartist%,%artist%)/$if($ne(%albumartist%,),%album%/)$if($gt(%totaldiscs%,1),%discnumber%-,)$num(%tracknumber%,2) $if(%_multiartist%,%artist% - ,)%title%

```

---

<div class="post-metadata">

**Author:** ![rakader](https://community.metabrainz.org/letter_avatar_proxy/v4/letter/r/f4b2a3/32.png) [@rakader](https://community.metabrainz.org/u/rakader)\
**Post date:** [May 24, 2018, 1:23pm UTC](https://community.metabrainz.org/t/script-track-number-and-title-on-mac/381825/3 "2018-05-24T13:23:50Z")

</div>

> [@outsidecontext](#):
>
> $if2(%albumartist%,%artist%)/$if($ne(%albumartist%,),%album%/)$if($gt(%totaldiscs%,1),%discnumber%-,)$num(%tracknumber%,2) $if(%\_multiartist%,%artist% - ,)%title%

Hi outsidecontext,

thank you very very much for your help. It works fine. For me this kind of scripting is too complicated; I understand the single tasks but not the syntax for itself.

I save the metadata in the right pane. I don’t know what saving in the left area is good for…  
May I be so free to push a few basic questions from a beginner?

1. If there are uppercase letters in the filename how I make a correct spelling?
2. The same I’m asking for the tags itself?
3. How can I delete “feat.”, “featuring” and put for this an “&” in the name of the tag?
4. If there are more than two artists, how I can say to Picard that every artist will be seperated through a “,” but the last one will seperated through a “&”?
5. How can I prevent “various artists” for being used automatically? (I hate it, it is absolutely redundant.)
6. How can I prevent the genre tag for being set automatically?

Many thanks in advance and best regards  
Radulph

Edit: Also I’m missing an option to change folder names if this are wrong, but instead of an “:” with an " - ", because my NAS don’t accept “:” (I named my folders often wrong from my vinyls.)

> **Summary**
>
> This text will be hidden
