Actions - Saving to the Original File's directory


#1

I am trying to make an action that opens a file, applies some changes to it, then saves it as a different filetype in the same location. I have all but the last step working perfectly, but I can only manage to make the files go to one particular directory. I want very much to establish this action as a part of my pipeline, since I have a great number of images to work with. Any suggestions?


#2

I’ve never been able to do this with Actions, but you can probably do it with Photoshop Scripting (which is actually easier than you may think).


#3

oh dear, I was afraid it was something like that. Know where a poor artist can find a Scripting for Dummies webpage? :stuck_out_tongue:


#4

Actually there is a fair bit of info on this dark art floating around.

This is a good place to start. There is also a bit of documentation that ships with Photoshop, including a small listener application that you can run in the background, which records all your activity in Photoshop - a useful way to learn to build basic scripts is to copy what’s going on in the log, and adapt it into script format.


#5

Thanks a lot!

I just noticed something, though. In the Actions menu, there’s a preset called “Save as PSD.” In this action, the only command is Save As, and in the “In:” parameter, it just says “File or folder not found.” I assume this is what lets it save in different directories, but is there any way to reproduce it?


#6

I’m also running into this problem although it may be slightly differently; any scripting help would be appreciated !!

Problem: batch editing .jpg’s that are located in a hierarchy of folders.

Through actions and batch automation there is no option to save in its respective folder… (this is only possible if saved as PSD, which happens automatically). There is an option to open all subfolders, but all files can only be saved in one destination folder. I want to save each file in the same folder it was opened from.

I’ve written the editing function in javascript, which resizes and retouches the image, and I’m trying to write something that will open all files in a hierarchy and save them in their respective folders.

So far:

var fileReference = new File(“C:/Images/Jewelry/Alex Sepkus/image.jpg”)
var docRef = app.open (fileReference)

ResizeTheImage(400, 400); //this function edits the image

jpgSaveOptions = new JPEGSaveOptions()
jpgSaveOptions.embedColorProfile = true
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE
jpgSaveOptions.matte = MatteType.NONE
jpgSaveOptions.quality = 10

app.activeDocument.saveAs(fileReference, jpgSaveOptions, true,
Extension.LOWERCASE) //saves the same file that was opened


How would I go about opening all the files in a certain directory and sub-directory?


#7

I’ve been using automate->batch to convert images to a different color profile and then save them as EPS in their original folder.

  1. First record an action with all the stuff that you need and then WITHOUT stopping the recording go to file->save as, then just change the filetype and click save (ive only used this to save to EPS so dont know if there will be some problems with other file formats)

  2. Now that you have your action ready go to file->automate->batch and set
    “Source” to “folder”
    uncheck “Override Action ‘Open’ Commands”
    check “Include All Subfolders”, “Supress File Open Options Dialogs” and “Supress Color Profile Warinings”
    Destination set to “Save and Close”
    and check the “Override Action ‘Save As’ Commands”

And thats it, it works for me in CS2 and CS3.

Here is a screenshot of the batch dialog settings:
http://img158.imageshack.us/img158/4614/batch1fw6.jpg

Hope this helped


#8

Thanks for your reply. The file type does make a difference however. I not only want to save as a .jpg but I’m actually ‘saving for web and devices’, which compresses the image for the web but pops up an annoying dialogue whenever it replaces a file with the same name, and I haven’t found a way to suppress this. Furthermore, it seems I can’t configure the export command to save in a different folder each time the action is executed. It seems the folder I use when I record the action is hard coded into the action and never changes, unlike when I use a .PSD extension, which saves the PSD in the respective folder I opened the original file from.


#9

I’ve scripted the solution. Anyone who’s interested download the script from my website:

http://alanvincenzi.com/blogs/GD/?p=1


#10

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.