Hi @rafapratas - welcome to the forum.
As I have this script working actively in my Picard configuration I will show you how to set it up.
Firstly I am expecting you to be running the latest version of Picard, click Help > Check for Update to confirm you are on the latest version:
Process:
-
With Picard Open click Options > Options to open the Options dialog window:
-
Click on Scripting from the left Tree Menu
-
Click Add new tagger script - It will create an entry called “My Script (1)”
-
Double click on My Script (1) and change the name to GetOldestDate
-
With GetOldestDate selected, copy the following into the right pane:
$set(date,$if2(%_recording_firstreleasedate%,%originaldate%,%date%))
-
Ensure Enable Tagger Script(s) is ticked and that GetOldesteDate is ticked too, your window should look similar to this:
-
Click “Make It So!” to save changes
Now find a track, the Date ID3 field should now take the earliest date for that recording.
(the example above is a CD compilation from 2003, but the song is from 1967, as you can see the Date field is set correctly)
Hope this helps