Action “save as” to current folder.

RG
Posted By
Rags_Gardner
Apr 22, 2004
Views
4910
Replies
9
Status
Closed
Does anyone know how to record an action that includes “save as” and get the saved file to be in the same folder as the source image? I can override the target directory in the batch automation. But if I just try to “run” the action on an open image PS insists on saving it in the folder that was used when the action was recorded. If the folder does not exist, it renames the file to the old folder name. If I toggle a dialogue on, it defaults to the current folder (as I would want), but now I have a dialogue I have to respond to.

This is frustrating. I just want the action to save the new image in the current folder, wherever that happens to be.

Photoshop CS.
Cheers, 🙂 Rags

How to Master Sharpening in Photoshop

Give your photos a professional finish with sharpening in Photoshop. Learn to enhance details, create contrast, and prepare your images for print, web, and social media.

MM
Mick_Murphy
Apr 22, 2004
This came up a few weeks ago. The following only works in CS which caused a bit of confusion when I posted it last.

In the Batch dialog box, choose Save and Close as your Destination, tick Include Subfolders and Override Action Save As Commands. You must have a Save As in the action of course to do what you want to do but ticking that box will cause the action to ignore the destination from the action and just save them in the same folder as the files are in.
DR
Danny_Raphael
Apr 22, 2004
The benefit of the CS solution Mick noted is that it works with multiple source folders, e.g., when the ‘subfolders’ option is selected. FWIW: The Source folder can contain physical folders or aliases that point to folders located elsewhere.

For those who don’t have CS yet, you can change file format and save reformatted files to a single folder, including the original folder, by making these settings in the Batch dialog:
* Destination: Folder. Choose (and browse to Source folder) * Turn on the "Override Action "Save as" commands" option as Mick said.

BTW: Be sure your action does not include an Open command or if it does either disable it in the action or check the "Override Action ‘Open’ commands" option.
RG
Rags_Gardner
Apr 22, 2004
Mick & Danny,

Thank you both. I tried to explain that I do know how to do it with batch automation, PS 7 or 8.

The problem is with opened images and action – run. Unless you set a dialogue, this will try to save in the folder that was active when the action was created. Even if that folder no longer exists. The action does a lot of other stuff. The dialogue is a real pain.

Cheers, Rags 🙂
DR
Danny_Raphael
Apr 22, 2004
Saw "I can override the target directory in the batch automation" and ass-u-me-d you wanted to do this in batch. Sorry about that.

Before making any more wrong assumptions, describe your workflow, e.g., how do the images get into the PS window? Do you manually open them via File > Open? Import several from a scanner or digital camera?

Does the action change file format, e.g., you start with (say) .psd and you save as .jpg (or something like that) or are you just saving a modified image over its original?

"…save the new image in the current folder" can be interpreted differently by different people. What’s your definition of "current folder"? The one from which the last image was opened or something else?

This info will help.
MM
Mick_Murphy
Apr 22, 2004
AH! Once again I read too fast for my own good. Apologies Rags. Offhand I don’t know any way to do this through an action. However it is possible with a very simple JavaScript which you could assign a keyboard shortcut to. If you just want to overwrite a file without changing file formats do the following:

Open notepad and copy the following single line of code. It’s case sensitive.

app.activeDocument.close(SaveOptions.SAVECHANGES)

Then save it as whateveryoulike.js (make sure it’s .js) and put it in C:\Program Files\Adobe\Photoshop CS\Presets\Scripts (make sure PS is not running). Then start PS and it will appear in your scripts menu and assign a keyboard shortcut.
MM
Mick_Murphy
Apr 22, 2004
Sorry, misreading again. I’ve got to slow down. That will save the file to its original folder. It needs a line or two added to get the current path. Offhand I don’t know the JavaScript for this (I use VB but that will not allow you to set a shortcut key as it has to be run from outside PS) although it is undoubtedly very simple. If you ask this in the scripting forum, I’m sure somebody will help.
DR
Danny_Raphael
Apr 22, 2004
Mick:

While you’re "slowing down" :), how would you define "current folder" (or path) in the PS sense? If I opened two images via File > Open from different folders, would "current folder" be the last one?
MM
Mick_Murphy
Apr 22, 2004
I haven’t slowed down yet Danny but I would guess it is the directory of the most recently opened file. I’d have to check by testing it. In Visual Basic, there is a simple function CurDir which gives the path of the current directory and you would simply add that as a string to the file path with the file name when saving. I don’t know the equivalent in JavaScript and right now I haven’t got time to find out…. gasping for breath….. life’s so short…… toomuchtodo… whattzthecurrentdirectory……….. goodquestion……..
MM
Mick_Murphy
Apr 22, 2004
That was a great question Danny. Basically, the current directory would only have meaning in scripting if you also open the files through scripting (in VB at least). Otherwise the scripting interface has no idea what PS is doing. Afraid it’s back to square 1. Proceed to the scripting forum.

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.

Related Discussion Topics

Nice and short text about related topics in discussion sections