Photoshop duplicate current document

I’m attempting to duplicate a document in photoshop and control the name of the duplicated document, with little success. Does anybody have an idea what I’m doing wrong, or if this is possible? Here’s my script…

tell application “Adobe Photoshop 7.0”
tell current document
duplicate with properties {name:“Test”}
end tell
end tell

I get a duplicated document, but it always has the same name as the original with the word “copy” appended.

Any help appriciated.[/b]

I’m not sure why you want to do this exactly. If you duplicate an image, it isn’t saved anywhere yet and you will have to specify the location (and the name) when you save it. As to the actual question (beyond the reasoning behind it), the name property seems to be read-only. To set it, you’ll need to save the document. The following script will save the document in your temporary items folder and give it the name “Test.” Be careful, however, because you’ll still need to do a “Save as…” to save it in the proper location when you’re done with it (assuming you want to keep it). If you just want it for testing, then don’t worry about it.

Hope this helps,


I was hoping that it wasn’t read only, oh well, thanks for checking.

I was having Photoshop dupe a opened file to make differen web files from the original, then “save for web” through an action to a specific location instead of saving through “save As” as the files are much smaller. And I can’t find in the Photoshop dictionary how to access the save for web via applescript.

Anyway, Thanks again.

You could have said what you really wanted to do in the first place. :slight_smile:

What I do is open a document and create a new Action named “Save For Web” in my Action set. Record the new Action to have a single step: choose “Save For Web” from the file menu, select my options and save. Stop recording the Action (you only have to create the Action once). Then, with a file I want to export opened and active, I run the script below. The script will save the file to change the name so the “Save For Web” action will ask me if I want to replace the file I just created. Clicking yes is all I have to do. For that you could set System Events to press it for you for a completely automated script.


Thanks, Jon

I think your solution will solve my problem, sorry it took so long to get back to you.

Thanks again, -JJ