Photoshop Overwrite exisiting file

I’m using this line to write over an exisiting document if it exists already

Save in (localBrandFolder_PSD) as Photoshop format with options myPSDOptions without copying

This doesn’t give the behaviour that I expected.

Previously on other applescript I have used it in this was

Save in (localBrandFolder_PSD) as Photoshop format with options myPSDOptions with replacing

However the word replacing turns green (as a set value) and hence doesn’t work for me.

Any pointers please


What behaviour do you get with the first example?

I haven’t done any teting, but do you need the “with replacing”

tell application "Adobe Photoshop CS5.1"
	save in (localBrandFolder_PSD) as Photoshop format with options myPSDOptions -- with replacing
end tell

I thought Photoshop would just write over any file you told it to.

Thats right.

if a file exists, PS replace it.

with or without copying means only that u can save the document as a document copy under a new name. the original name of the document dont change with copying.

for example:
thats important when you save various files in different sizes per script from one opened document. with the save option “with copying” your original document name dont change and you can get back in history to do another size and save.
when you use “without copying” the original name changed to the new saved name and you cant get back in history.
(you can use a snapshot instead of setting the history state back)

greets from

Hi. I saw this over on the Apple discussion board, too. Here’s what I posted there:

It sounds like your full final path to the final file name is in the variable “localBrandFolder_PSD”, and that the problem you are having it just making it overwrite any existing file on file save. Is that correct?

If so, the simplest solution would be to just do a quick shell script to delete the existing file right before saving. That would mean you don’t have to worry aobut PS overwriting. You will ensure that no file exists there.

Something like:

set theShell to "rm -f " & quoted form of ((POSIX path of localBrandFolder_PSD))
do shell script theShell

Model: iMac
Browser: Firefox 3.6.4
Operating System: Mac OS X (10.6)