# Cover Art: Script to fill comment from uploaded filename?

**URL:** <https://community.metabrainz.org/t/cover-art-script-to-fill-comment-from-uploaded-filename/288403>\
**Category:** MusicBrainz\
**Tags:** userscripts, cover-art, bookmarklets, musicbrainz\
**Created:** [June 17, 2017, 11:34am UTC](https://community.metabrainz.org/t/cover-art-script-to-fill-comment-from-uploaded-filename/288403 "2017-06-17T11:34:39Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![InvisibleMan78](https://community.metabrainz.org/letter_avatar_proxy/v4/letter/i/c67d28/32.png) [@InvisibleMan78](https://community.metabrainz.org/u/InvisibleMan78)\
**Post date:** [June 17, 2017, 6:47pm UTC](https://community.metabrainz.org/t/cover-art-script-to-fill-comment-from-uploaded-filename/288403/2 "2017-06-17T18:47:14Z")

</div>

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](https://en.wikipedia.org/wiki/Bookmarklet).

Together with [my other script](https://community.metabrainz.org/t/script-to-set-all-types-of-all-ready-to-upload-pictures/69868/12) the upload for multiple cover art should be a little bit easier now.

---

_[View the full topic](https://community.metabrainz.org/t/cover-art-script-to-fill-comment-from-uploaded-filename/288403)._
