Just want to make a new folder and label it green

I’ve been searching all over the Internet and this website and can’t seem to find where to set this new folder to a green label.

This is what I have so far that works:

tell application "Finder"
	make new folder at desktop with properties {name:"TEST FOLDER"}
end tell

How do I also have that folder have a green label? I’ve tried a bunch of methods and all I get is errors.

I’ve tried something like this but just get errors:

tell application "Finder"
	make new folder at desktop with properties {name:"TEST FOLDER"}
	set label index of "TEST FOLDER" to 6
end tell

HI. Your second example was very close to working, but, the problem is that your object was a string, which has no label property. Use the folder specifier.

tell application "Finder"
	make new folder at desktop with properties {name:"TEST FOLDER"}
	set label index of folder "TEST FOLDER" to 6
end tell

Hi.

Marc’s beaten me to the reply. But I did mean to add that although the Finder’s default search location is the desktop, it would be better to specify explictly that that’s where the folder is:

tell application "Finder"
	make new folder at desktop with properties {name:"TEST FOLDER"}
	set label index of folder "TEST FOLDER" of desktop to 6
end tell

Or, since the ‘make’ command returns a reference to the created folder, you could use that:

tell application "Finder"
	set newFolder to (make new folder at desktop with properties {name:"TEST FOLDER"})
	set label index of newFolder to 6
end tell

Thank you both for your help. Works great.