How to modify title script in order to write in capital letters

Hi,

I know this is a very specific request, but I could not find a solution on my own (fault of my total ignorance with this matter). I refer to this script: Automatically creating titles with item specifics - #12 by kristian

I’d like to modify the script so that it takes text from one item specific (A) and writes it in capital letters into the title, also if text into the field t is not capital. Now I am writing directly in capital letters into field A, but I am sure there must be some trick to let GS writing title changing a specific text in capital letters. Is it possible to do?

Thanks in advance for any help.

Federico

Untested, slightly improved, version of Christian’s script:

function run() {
	for (const listing of selectedListings) {
		// enter preceding text optionally:
		var precedingText = "";
		
		// enter attribute names in the order you want them, e.g.:
		// var attributeList = ["Brand", "Model", "Color", "Size"];
		var attributeList = ["", "", "", "", "", "", "", "", ""];
		
		// leave everything below untouched:
		var finalTitle = "";
		
		for (const attributeName of attributeList) {
			if (listing.attributes[attributeName] && listing.attributes[attributeName] != "") {
				finalTitle = finalTitle.concat(listing.attributes[attributeName], " ");
			}
		}
		
		listing.title = (precedingText + finalTitle).toUpperCase();
	}
}