Folder action to add Spotlight comments

I need a folder action which will add a specific set of Spotlight comments to each file that is dropped into the folder, but unfortunately it appears that I am an idiot who is incapable of creating such a thing all by himself.

Aidez-moi, Obi-Wan Kenobi.

Hi,

I can’t test this right now, but the folder action will be something like:

on adding folder items to theFolder after receiving addedItems
repeat with theItem in addedItems
addComment(theItem)
end repeat
end adding folder items to

on addComment(myItem)
set myComment to "Your comment" -- Change to needed
tell application "Finder" to set comment of myItem to (comment of myItem & return & myComment)
end addComment

Best wishes

John M

I am sure that John M’s probably works just fine.
but since I was bored and working on it before he posted his I thought I might post
this. thanks


on adding folder items to this_folder after receiving these_items
	repeat with i from 1 to number of items in these_items
		set this_item to item i of these_items
		tell application "Finder"
			set comment of this_item to "this is where your comment goes"
		end tell
	end repeat
end adding folder items to

Thanks so much you both! I wish I could get my feeble mind around this stuff.