Cover Art: Script to fill comment from uploaded filename?

I try to upload 150 x 3 Covers for the Haydn complete works:


Could someone please tell me how to write a Bookmarklet (Script) to prefill the comment with a part of the uploaded filename?

Example:
I upload a Front-, a Back- and Medium-Cover called
Front001.jpg
Front002.jpg

Back001.jpg
Back002.jpg

Disc001.jpg
Disc002.jpg

and the comment should be prefilled with
CD1
CD2

for every type of cover. The number should be extracted from the filename.

This would extremely simplify my uploading task.
Any ideas how to do that?

Again, I’m not a script guru like @jesus2099.
This little bookmarklet let you enter a start-number and an optional comment text for your ready-to-upload cover art pictures.

Every comment field will be filled with the comment text (if entered) and the number. The text will remain the same for all comments, the number will be increased +1 for every ready-to-upload picture.

I made it for my 3 x 150 Haydn covers. I can now upload as an example 20 Front covers (of course they must be in the correct order) and then use my script to give them the number 41-60 and the text “CD”, resulting in the comment text “CD41” to “CD60”.

Maybe this can help others too?
javascript:(function(){var start=prompt("Enter Start-#","");var commtext=prompt("Enter optional comment text","");var x=document.querySelectorAll("input.comment");var i;for (i=0; i < x.length; i++) {x[i].value=commtext+[Number(start)+Number(i)];var event=document.createEvent("HTMLEvents");event.initEvent("change", true, true);x[i].dispatchEvent(event);}})();

This code should be entered as 1 line for a new bookmarklet.

Together with my other script the upload for multiple cover art should be a little bit easier now.

3 Likes