Can someone help me with the scripting?

Im using a mac and would like to sort it album these characters to be replaced with other characters for both the file name and music file. What would I put in for this?

" replaced with space
< replaced with space
? replaced with _
: replaced with _
\ replaced with _
/ replaced with _

Sounds like you need to use the $rreplace() function. For more information have a look at https://picard.musicbrainz.org/docs/scripting/. I believe that you’ll need to run your text through it twice – once for each replacement character. It should look something like:

$rreplace($rreplace(your text to process,["<], ),[?:/\\\\],_)

If this isn’t what you were asking or need more explanation, please include more information about what you’re trying to do (including a copy of your current script).

Thank you for the reply. What I want to accomplish it this in the example

Song Title - Intro: Is this the end?
Album - Wings “Part 2”

So then if the sorting was album, song with the characters changed it should be like this-

/Wings Part 2 /1-01 Intro_ Is this the end_

This the current script that I have

$if2(%albumartist%,%artist%)/$if($ne(%albumartist%,),%album%/,)$if($ne(%discnumber%,),%discnumber%-,)$if($ne(%albumartist%,),$num(%tracknumber%,2) ,)$if(%_multiartist%,%artist% - ,)%title%

1 Like

Thanks for the clarification. If I understand correctly, I think the following will do what you want to accomplish:

$rreplace($rreplace($if2(%albumartist%,%artist%),["<], ),[?:/\\\\],_)/$if($ne(%albumartist%,),$rreplace($rreplace(%album%,["<], ),[?:/\\\\],_)/,)$if($ne(%discnumber%,),%discnumber%-,)$if($ne(%albumartist%,),$num(%tracknumber%,2) ,)$if(%_multiartist%,$rreplace($rreplace(%artist%,["<], ),[?:/\\\\],_) - ,)$rreplace($rreplace(%title%,["<], ),[?:/\\\\],_)

If this doesn’t do it, please let me know what it’s not doing correctly and I’ll take another look.

I just tested the script everything works except " this still shows up when saving on folders/files, instead of spaces.

Okay, it’s doing some weird stuff with the quotes. Try the following to see if that makes a difference. I did some testing and it seems to be working here.

$rreplace($rreplace("$if2(%albumartist%,%artist%)",["<], ),[?:/\\\\],_)/$if($ne(%albumartist%,),$rreplace($rreplace("%album%",["<], ),[?:/\\\\],_)/,)$if($ne(%discnumber%,),%discnumber%-,)$if($ne(%albumartist%,),$num(%tracknumber%,2) ,)$if(%_multiartist%,$rreplace($rreplace("%artist%",["<], ),[?:/\\\\],_) - ,)$rreplace($rreplace("%title%",["<], ),[?:/\\\\],_)

Ok, I figured out what went wrong with the quotes, when copied and pasted the script the quotes pasted where “ instead of " this. They read as different characters, I don’t know why it did that, but oh well.

So, the script in the second post you sent works just fine!

You help me a lot, thank you so much your hard work!!

1 Like

Thanks for letting me know about the quotes. I never thought about that. Glad you have it working and that I was able to help.

Hey boysyed… If you eventually see this post, I was wondering.

Is there particular programs or players which “don’t like” the characters you’re removing and replacing with spaces etc.?

Just curious… Wondering if this is something else I need to worry about. :wink: