What’s up with scripts?

Tags: #<Tag:0x00007f34284e5b20> #<Tag:0x00007f34284e5850>


The interface for scripts has changed a bit in Picard 1.4.2, but there are missing bits. I can add scripts, and they are added to Picard.ini, but I can no longer choose between scripts from the options interface. I also can’t get any scripts to work, but that may have more to do with my scripting skills.:slight_smile:

Could someone shine a light on this? I am using Windows 10.


That’s a user interface bug that unfortunately did not get fixed in Picard 1.4.2. The list of scripts is hidden, you can make it visible by dragging on the left side of the text area. See the following script:

Regarding you scripting skills: $unset(%script%) does probably not what you want. It would unset a variable with the name stored in the variable %script%. So the following code would unset the variable %myvariable%, not %script%:


The proper way to specify variables for $set and $unset is without percentage signs. The following actually unsets %script%:



Does that bug only occur on Windows 10? It worked fine for me on Windows 7 before.

It’s very annoying that you have to use percentage signs in some places, but not in others. It doesn’t help that $unset doesnt work at all here, with or without the tag between percentage signs. And I’ve tried lots of different tags. $set works, $unset doesn’t. Does anyone else have this problem?


No, it occurs on all platforms. It depends on the initial size of the preferences dialog.

It’s rather easy: You use percentage signs to access the value of a variable. When you define variables you just give the name.

Can reproduce. Some tags work, e.g. title and artist, but a lot don’t. Haven’t tried them all, but added a bug report:



At least Picard scripting has a way to deal with variable references. E.g., you could do something like (may or may not work in Picard):

if(eq(releasetitle,Your Mother was a Hamster),set(swallow,foo),set(swallow,bar))

This would sometimes set the artist name to “African” and sometimes to “European”. Of course, this is a bad example, since you could just set %artist% straight in the if(), but there are more advanced uses where this can come in handy. :slight_smile: (I’m sure this construct has a proper computer sciency name. It’s fairly common in all the major languages AFAIK, including shell scripting…)


I get tripped up by this, too, but they ARE different things. As @outsidecontext says, without the percentage sign you’re telling Picard what you want that field to say. With percentage signs, you’re asking Picard to look at the actual value of the variable. So $set(mytag,artist) would set mytag to a value of “artist”, whereas $set(mytag,%artist%) would set mytag to whatever value is in the artist field.


Thanks for the explanations, but could someone who fully understands Picard scripting please add that information to the scripting documentation? Because in its current state that page is only useful if you already know how everything works and onlky need some reference.