How do you get an Action to Save As and replace a previous copy?

JZ
Posted By
John_Z_Marshall
Aug 9, 2004
Views
1686
Replies
15
Status
Closed
Okay, Photoshop CS running on a conventional Dell system.

I’m making a texture for a 3D model, based on a PSD layered file, but then exported as a TGA – a 24-bit TGA, no alpha. What I can do manually is Save As and switch PSD to TGA in the dialog. For some reason, the ‘As Copy’ checkbox insists on being checked and grayed, which means it wants to make the file into ‘filename Copy.tga’. I can click on the previous file and get it to set the name as ‘filename.tga’, and then respond ‘Yes’ when it asks if I REALLY want to replace it. And then the TGA dialog about what bit depth. Fine.

I can set all this up in an Action, but it seems incapable of saving over the previous file version. I’ve tested it, and it does create ‘filename Copy.tga’, even when I recorded the creation of the replacement ‘filename.tga’. The warning in the Save dialog that says "File must be saved as a copy with this selection." seems to be mocking me, and I can’t get it to go away.

In previous PS versions I would have used the ‘Save a Copy As’ menu item, but since that has been reduced to a checkbox, that option is not there.

All I want is for Actions to be strong enough to save over previous copies and end up with a new exported file with the same name. "Is that so wrong?" If there’s a switch to be flipped somewhere, please help me locate it. Thanks.

Master Retouching Hair

Learn how to rescue details, remove flyaways, add volume, and enhance the definition of hair in any photo. We break down every tool and technique in Photoshop to get picture-perfect hair, every time.

Y
YrbkMgr
Aug 9, 2004
In your action, toggle the dialog to OFF in the Save As portion. Should work without inserting "copy" in the filename and without user intervention.

Peace,
Tony
JZ
John_Z_Marshall
Aug 9, 2004
Tony, if you mean that I should open up the Action’s Save dialog and toggle the ‘Copy’ checkbox, I can’t. It’s still grayed out.
Y
YrbkMgr
Aug 9, 2004
No John. What I mean is, in the actions palette, next to the action name, and for many steps within an action, there is a dialog box toggle. You’ll notice in the palette that sometimes this little square is empty (toggled off) and sometimes it’s got a funny little icon in it (toggled on).

When you look at the action you created, somewhere in there is the step to Save As. Just to the left of it, make sure that the dialog box is toggled Off.

Now that I’m thinking about it, using the method I’ve described works well for batch saving, not for discrete image saves.

What I deduce from your message (after thinking about it more) is the fact that you are saving to targa and some of the contents of the file are not supported. It might be layers, or it might be that you are toggling the Alpha to Off in the Save As dialog. This will ALWAYS gray out the "copy" toggle. So you might want to include a step in the action that "prepares" the image for saving to targa.

Maybe that means a flattening step, maybe that means including the deletion of the alpha channel before saving.

Point is, you will need to make sure that the file contains everything you want in the targa format prior to initiating the Save As action.

Peace,
Tony
DR
Danny_Raphael
Aug 10, 2004
John:

I was experimenting with Tony’s suggestion and it appears to work in my environment. If for whatever reason it doesn’t do the trick, here’s another approach to consider.

Is your situation that you’re literally processing one image at a time or would you ever need to process a folder full of images as a batch? If the later, the File > Automate > Batch command might be worth a look.

With it you can apply your action to all images in a Source folder, save the processed images in a Destination folder and (except for the file name suffix) retain the original file name w/o the annoying inclusion of "copy" or need to reply to dialogs. No muss, no fuss. Note: Destination option "Ignore Action ‘Save As’ commands" must be on. Sounds bass ackwards, but the effect is to honor the Save as .tga characteristics w/o the annoying dialogs + keep the original file name.

If your requirement is in fact one file at a time, Batch might still offer a solution. In the Source option, choose Open Files from the menu. Same setting for "Ignore Action…" option.

~Danny~
JZ
John_Z_Marshall
Aug 11, 2004
The dialog toggle on my Action is off, and was from the beginning.

Okay, let me clarify my workflow and the reasons behind it. What I want to be able to do is:

1. Work on my Photoshop layers file

2. Save a copy of the file into a Targa file — this would be a Copy, as I said, like the old ‘Save A Copy As’ command, and Photoshop will necessarily flatten the file info with my chosen Targa format. It doesn’t need an alpha channel.

3. Switch to my modeling program and check my updated texture. This is why I want the TGA to be replaced and the filename to remain the same as before — my modeler automatically updates the texture file.

4. Switch back to Photoshop and continue working on the Layers file

5. Repeat

Now, I know guys who are pro game artists who do this all the time, and have Actions that work as I want mine to. However, there is some detail that’s making theirs work and mine not, and I’m trying to find the problem.

What this comes down to, I think, is that the Action is incapable of saving over a previous file with the same name. Is this true? I hope not.
Y
YrbkMgr
Aug 11, 2004
Okay, two things.

First, let’s get the issue of "copy" in the file name out of the way.

That will only happen when there is a feature in your PSD that will not be handled in your targa file. For example, Save As Targa, will automatically flatten layers, but it does not include the alpha channel(s). Since that will NOT be included, photoshop automatically will indicate that this is a "copy" in the file name, and the dialog box will be grayed out for unchecking the "copy" option.

In a similar vein, if your image has layers, Photoshop will include "copy" when saving as Targa, since the resulting file will not include the layers.

This is true of how photoshop handles all files, including JPG’s. Yes, it will automatically flatten them, and the alpha channel won’t be included, but it is "flagged" as a copy, period.

So in your stated workflow, you might consider this as an action: Take a history snapshot, flatten image, delete alpha channel(s), Save As Targa. Then go to the history palette and restore to your snapshot.

That will avoid the "copy" issue.

Now, on the issue of overwriting the file name. The only way to do that is with the dialog box of the action set to ON. And that will, by its design, force the dialog box on screen, requiring you to confirm that you will overwrite the file in question.

If you record an action that has a specific filename and location in it, and you have the dialog box OFF, it will always write the filename that you recorded in the action, in the location specified in the action.

So I’m assuming that you work with different textures, and thus different filenames. That’s why you will need to confirm the overwrite everytime you save with the action – otherwise you will always save with the filename in the action.

Peace,
Tony
JZ
John_Z_Marshall
Aug 11, 2004
Tony:

It seems that you’re saying that the way to get rid of the ‘Copy’ in the filename is to give my TGA and Alpha channel? Or do I have that backwards? In any case, my PSD has no Alpha channel, and I don’t understand why that should be a problem.

If I understand the part about overwriting the file, you’re saying that the confirm dialog is required to do that. But your next statement seems to say that the Action will always overwrite the file when the dialog is toggled off. Huh?

Here is a text dump of the Action I recorded. I noticed that the filename is NOT included. Is there some way to change that? What I have always used is a PSD file with the exact same name as the texture TGA, so that all I have to do is change the file format extension.

Action: make cap TGA
Save
As: Targa format
Bit Depth: 24
RLE Compression: 0
In: C:\convex\reload\models\players\reloadguy\
With Copy
JZ
John_Z_Marshall
Aug 11, 2004
Okay, I found the fix. The missing component is the Duplicate command, which fixes the whole name issue.

When Duplicate creates a clone of the PSD file, I chose ‘filename.tga’, and that was where the name was set in the Action, NOT in the Save command. Since this is like creating a brand new file, the ‘Copy’ problem is eliminated, and with the dialog toggled off, it replaces the previous file. Done!

Thanks for your hard work of trying to explain all of this to me, Tony, and I’m sorry for being so thick.
Y
YrbkMgr
Aug 11, 2004
Okay, I’ll back up a step here…

Rule: if a feature is not supported in a particular file format yet exists in a PSD, Save As will put the words "copy" in the file name.

Okay, you don’t have alpha channels. You DO have layers. They aren’t supported by Targa, thus, if you do a Save As, you will ALWAYS have "copy" in the filename. It’s just the way it works.

Try the same thing with a JPG. Multi-layers – sure, it’ll flatten it when it save it, but unless you choose Save For Web, the file name will have "copy" in it.

In regards to the Save As portion of the action, think of it like this.

When you record a Save As action, you are HARD CODING (for lack of a better term) the actual filename you want to use and its destined location. It doesn’t work like the Save command, which just saves the file with the same file name and any changes you’ve made.

So what does this mean? You have an action in which you have recorded "Save As Targa, filename= Joe.tga, location= My Documents".

With the dialog toggled to off, every time you run the action, no matter what your filename currently is, it will be renamed to "joe.tga", and will be saved to the "My Documents" folder.

The ONLY way to prevent that is to turn the dialog box ON. Then you can place the file where ever you want, and name it whatever you want, including overwriting the exiting file (after confirmation). Doing it this way, the default filename in the Save As dialog, will be exactly the same as the current filename, only it won’t have "copy" in it, provided you flattened the image first.

Make sense?

Peace,
Tony

edit You posted your reply while I was typing this. Sure, duplicate is a good workaround provided that there aren’t any layers in the image.
JZ
John_Z_Marshall
Aug 12, 2004
Okay, for the sake of clarity, here is the text dump of the final Action. Assume you have a layered PSD named ‘texture.psd’. The name given to the Duplicate file is hard-coded. Then it’s Flattened, Saved, and Closed.

Action: make TGA

Duplicate first document

Name: “texture.tga”

Flatten Image

Save

As: Targa format

Bit Depth: 24

RLE Compression: 0

In: C:\models\players\guy\

Close
Y
YrbkMgr
Aug 12, 2004
Just keep in mind that with the dialog toggled to off, ANY texture you create/save will be named "texture.tga" and will be placed in the "C:\models\players\guy" folder.

That’s fine for THIS texture, but textures that are written for "\girl" for example won’t be placed in that folder, and will overwrite the previous TGA in "\guy".

I don’t know that this is important to you, but you should be aware.

Peace,
Tony
JK
Julian_K
Aug 13, 2004
yeah John, YrbkMgr (jeez what a name:) is right. what I do to overcome this and not having to change the action for every new texture I work on, is the following:
have your reloadguy.psd open, save it as a reloadguy.tga, open that tga and leave it open. now select your psd and record this :
select all – copy merged – select the tga – paste – flatten – save – go back to psd – deselect. if you want I can also mail you that action. one problem I have btw, with PS ( from 7 on to CS) is that no matter how I overwrite a texture file (action or manual) that is supposed to be updated in realtime in my 3d program, SOMETIMES i get the error that this can’t be done because the regarding file is left open or used by another programm. very often it just does it but then randomly refuses. very odd. I’d be happy to find out why.
Y
YrbkMgr
Aug 13, 2004
very often it just does it but then randomly refuses

Yep. It’s an often reported, yet unreproducable anomaly. The secret is to close all images except the one you are trying to save and THEN save it.

Strange, but true.
JK
Julian_K
Aug 13, 2004
that of course would render a quick save action useless 🙂 it might sound like a very minor issue, but in the workflow of texturing 3d models it’s quite a pain.
Y
YrbkMgr
Aug 13, 2004
Yep. But it’s not consistent enough. Once in a while it will happen.

Must-have mockup pack for every graphic designer 🔥🔥🔥

Easy-to-use drag-n-drop Photoshop scene creator with more than 2800 items.

Related Discussion Topics

Nice and short text about related topics in discussion sections