Adding names from list to text on a photoshop document

I have followed the post “Post subject: How to put filename on images” - and it makes good sense, but I need to go a step further and add names from a list, generating a new photoshop document with each name.

If the name list is comma or tab deliniated, can applescript merge the list with the background document by adding the text layer, then saving as a jpeg, using the name as the document name (thus preventing overwriting)?

Thanks for the consideration,


Try this. It assumes you’re putting the names on a copy of the same document, which is already open.

set nameList to {"Larry", "Curly", "Moe"}
tell application "Adobe Photoshop 7.0"
	make new art layer in current document with properties {kind:text layer, name:"Name Layer"}
	-- insert your text formatting here
	repeat with eachName in nameList
		set contents of text object of art layer "Name Layer" of current document to eachName
		save current document in file (destinationFolder & eachName as string) as JPEG with options {class:JPEG save options, quality:5} with copying
	end repeat
end tell

You end up with 3 jpegs named with the different names.

I have gotten this far with your help, but i seem to be getting hung on the font issue, the Syntax checker is happy, but when the script is run is hangs on "can’t set font of text to “copperplatebold”.

Here is the script, can you offer any further advice?

set mystring to “Sarah Morrison
Ashlee Bowman
Ben Clark
Matthew Hughes
Evan Casey
Tegan Simms
Rachel Meacle
Kathryn Jones
Jacinta Connell
Zoe Daniell
Heide Drummond
Laura Tisato
Amy Manos
Pip Ward”
set AppleScript’s text item delimiters to “return”
set theitemlist to every text item in mystring
tell application “Adobe Photoshop 7.0”
make art layer in current document with properties {kind:text layer, name:“Name Layer”}
tell text
set font to “CopperplateBold”
set colour to {R:255, G:255, B:255}
set size to 24 as point
set justification to center
set text position to {432 as point, 343 as point}
end tell
end tell
repeat with eachName in nameList
set contents of text object of artlayer(“Name Layer”) of currentdocument to eachName
save currentdocument in file ({desktop folder, mercedes to (print) & eachName} as string) as {JPEG, quality, 12} with copying
end repeat

I greatly appreciate your help!


Um, no. There are a lot of things wrong with your code. Here is code that will do what you want:


[This script was automatically tagged for color coded syntax by Script to Markup Code]

Thankyou Jon, it works well.

Without imposing on you too much, can you guide me as to where my logic was primarily wrong? I have been scripting on and off for a year now, the trouble is although I have two books on the subject and have worked on many projects, I struggle with it enormously, most of my successes are either accidents or borrowed code. I am not learning anything from my mistakes.

Is it obvious from my mistakes with the code (I supplied) what I am missing in my understanding, am I approaching it from the wrong direction?

I’d appreciate any advice, you and Carl have already been a great help. Thanks!



Please see my comments that have been added to the code you posted:


[This script was automatically tagged for color coded syntax by Script to Markup Code]

The font naming issue, where do I get the proper name of a font, “Copperplate Bold” never appeared in PS, nor did it appear as this in the fonts folder of my library?

The brackets around “Name Layer” were placed in response to the checking of Syntax errors in script editor, it showed errors without them in place. I rely on the check syntax too much.

And again, in trying to make the save line work, I was stuffing around for ages with the syntax checker when I should have been writing it out long-handed from start.

One additional thing Jon, if I wanted to use a sequential number for the file name in the save routine, instead of the “eachName”, what would I need to do?

Thanks for your patience,


Try setting the text to the font you want in a text layer and using the code I wrote in the comments to get the properties of the text layer. This will tell you the internal name of the font used by PS.



[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Thanks Jon, the renaming worked well, though I fooled myself by not setting the ruler units on the original document to points, perhaps a “tell” statement to set photoshop’s units to points would be a good addition.

I’ll use the little routine…

tell application “Adobe Photoshop 7.0” to return properties of text object of layer 1 of current document.

This will be very useful when sorting out the syntax of any application, the dictionaries are useful, but is they are not much help with the flow of the code.

One thing for everyone to beware of that unstuck me was when I copied your last code to script editor, many of the spaces were left out in the code, for example:

repeat with ifrom 1 to (count of paragraphs of mystring) 
       set eachName to text of paragraph iof mystring 
       set contents of text object of the_layer to eachName 
       set the_num to i 
       if the_num < 10 then set the_num to "0" & (ias string) 

Spaces after the “i” failed to copy, syntax checker picked these up and with comparison to your code in Safari I picked it up.

This has been a good learning experience for me, thanks for taking the time to explain things,


The missing space issue is a known problem with Safari 1.0. It has been fixed in Safari 1.1 released with 10.3. IE and other browsers do not have this problem.


This is a great reference and nearly works for me. I am using CS3 and it won’t save the files as jpg on the desktop but only creates the jpeg for the last item on the list with the name {original_name}copy.jpg. Also I think CS3 must refer to fonts in a different way because I get an error “Can’t set «class cFnt» to “Copperplate-Bold”. Access not allowed.” when using set font to “Copperplate-Bold” or anything else.

To make it perfect I would love to draw the names from an external file or even make two text layers from columns in an excel sheet.

Great work!