Tagger Script not responding

Hello,

I am trying to replace date with year, with this tagger script:

$if(%date%,\($left(%date%,4)\))

I have “Tagger Script” enabled, but when I save to rename files, the whole date appears in the directory.
This is the code I have for renaming:

%artist%/%date%/%album%/%artist% - %tracknumber% - %title%

Am I doing something wrong? :confused:

[quote=“oskargunn, post:1, topic:161872”]

$if(%date%,\($left(%date%,4)\))
```[/quote]

This doesn't actually *assign* the new value to the `%date%` variable. You will want to wrap it in a `$set()` function, like so:
```taggerscript
$set(date,$if(%date%,\($left(%date%,4)\)))

I’ve personally been using something like this:

$set(_year,$if(%date%,$left(%date%,4),XXXX))

Note that here I’m setting a new variable, %_year%, so you’d need to use this in the file naming string - the benefit of this is that %date% is left untouched and can be used for other things as well. This also sets the “year” to “XXXX” in case there’s no date (so you’re sure there’s always something) - and it doesn’t include the parentheses in the %_year%, so you’d have to add that in yourself where you want it.

The various functions are documented at https://picard.musicbrainz.org/docs/scripting/

1 Like

Thank you for your reply.

However I tried both methods and it doesn’t seem to work pick up the script.
When I use the second method with _year (so I change also to %artist%/%_year%/%album%/%artist% - %title%), the renaming skips the year folder, so i get artist\album\....
:confused:

Where do you set this script? It should go under Options > Advanced > Scripting, and this script es executed when data is loaded. So you should reload any albums before saving when you do changes to the script.

I put the script under Options>Advanced>Scripting and enable “Tagger Script”.
I completely removed all album references and files in Picard, and imported folder again. Even restarted the program.

Sorry, wanted to come back to this earlier. I am not sure what is happening here, but are you maybe saving files in the left pane instead if matched files in the right pane? The scripts are only evaluated for albums loaded in the right pane.

@oskargunn, were you able to find a solution to your problem?

I’m having a very similar issue. Running version 1.3.2 on OS X. @outsidecontext They are matched in the right pane, and I’m willing to guess @oskargunn also has them matched in the right as well.

@oskargunn could you let me know if you’re also running Picard on OS X and have them matched in the right pane?
Also, if you have already found a solution to your problem, can you please shoot a quick reply? It would help tremendously!