Need a script for pasting copyright info into Comments field

I’m pasting copyright info into the comments field of the info boxes on hundreds of files (mostly psd, tif, and jpg) on Mac OsX 10.2.6 . I basically just type the info into one info box’s comments field, then copy it and open the other info boxes one at a time (using the “Command+I” key shortcut), then paste the info into the comments field (using “Command+V” shortcut) of the info box for each document in a given folder. Then close the info window. As you can imagine this is very tedious. I know there must be a way to automate such a simple task on Mac OsX, although I’ve looked through numerous Mac OsX handbooks and can’t find any helpful advice.

I’ve tried opening applescript, pressing record and performing the task described above, but the applescript recorder doesn’t record the actions performed.

Does anyone out there know how to do this (automate this task) correctly on Mac OSX?

I basically just need the sentence “Copyright© 2003; Unauthorized use or reproduction prohibited by US copyright laws.” written into the comments fields of all the files in a given folder. Then the same info written in the files of another folder with only the copyright dates changed if anything.

Also whenever I change and save a file, my notes in the comments field in the info box for the file disappear and I have to re-enter it. On the old Mac Os, 8 through 9 anyway, the comments in the info field stayed there even if I changed and saved the file, or even if I changed and did a “save as”.
Is there a way around this MacOsX annoyance of deleting the info comments when making changes to and resaving a file?

What you want to do is ridiculously easy using AppleScript:

set commentText to "Copyright© 2003; Unauthorized use or reproduction prohibited by US copyright laws."

tell application "Finder"
	set comment of every file of folder "Macintosh HD:foldername:" to commentText
end tell

Obviously, change the path to the target folder to whatever’s appropriate for your setup.

Camelot’s suggestions works great! :smiley:

Now is there any way to apply the action in the script to all subfolders of a given folder? or do you just have to make a new script for each subfolder by name?

Thanks for your help,

You can use some interaction to assign the variables for both the comment and the source folder. As to the subfolders, there are lots of ways to do this (take a look on Code Exchange, ScriptBuilders, or do a search of the board). The routine I include below uses the Finder so it isn’t as fast as some of the other methods but it will (hopefully) make some sense to you (it uses recursion to get all the folder names):

You could also add an open handler and save this as an application to allow you to assign the parent folder via drag & drop (do a little searching as to how to do this if you’re stuck).

Good luck,


jonn8’s script works great!!! Thanks.

There’s just one more detail that I should have mentioned. I need the script to apply only to photoshop, jpeg, and tiff files.

I tried various things such as adding "whose file type is “jpg,psd,tif” " after the line “set (comment of every file of (item i of all_folders)”

but I get an error message when I try to run it.

If anyone can tell me what to add to the script (above by Jonn8) to make it apply only to PSD JPG and TIF files, I’d really appreciate it.


I am a bit new to scripting but you could try this:

tell application “Finder”
repeat with i from 1 to (count of all_folders)
if type of file i is “8BIM” then
set comment of every file of (item i of all_folders) to commentText
end if
end repeat
end tell

I think that is the correct format. What this does is check if the file in question if PhotoShop.
Hopefully someone with a bit more knowledge will check my suggestion.


If your files all have the appropriate extensions as defined in your list, just change the line

set comment of every file of (item i of all_folders) to commentText


set (comment of every file of (item i of all_folders) whose name extension is in {"jpg", "psd", "tif"}) to commentText


I tried the last suggestion by jonn8 but got the following error message when I ran the script:

Finder got an error: Can’t set comment of every file of alias "Western Digital HD 2:AddComments:"whose {“jpg”,“psd”,“tif”} contains name extension to “Copyright © 2003. Unauthorized use or reproduction is prohibited by law.”.

I checked all the files in the folder and they do have the proper .jpg .tif and .psd file extensions.

Note: “Western Digital HD 2:AddComments:” is the path to the folder on my hard drive.
The code works before changing the line as suggested, but puts the comment (copyright info) in the comments field of ALL files in the folders, not just the tif, jpg, and psd files, which still is of great help and will save me hours of time each week. If anyone has any idea why I’m getting that error message, though, please let me know.


Sorry, that last bit wasn’t thoroughly tested. I thought I could skip a step but it looks like I need to add another repeat loop. This should work: