Processing & housekeeping

Discussion of Automation, Image Workflow and Raw Image Workflow

Moderators: Tom, Kukurykus

simonh

Processing & housekeeping

Post by simonh »

Hi All,

i'm trying to orgsnise a workflow for a small publisher whereby the following happens....

1) JPG Images drop into Folder "A"
2) Photoshop CS4 polls Folder "A" and automatically runs an pre-defined 'action' on any images found
3) Photoshop deposits the processed image into Folder "B"
4) Once processing of each JPG is complete, the original JPG subsequently moved from Folder "A" to Folder "C"

The two parts of the workflow I can not figure out are:

a) how to get photoshop to permanently poll a folder
b) how to flush out folder "A" so that photoshop doesn't keep processing the same images.

Appreciate that Windows housekeeping might go over and above the abilities of Photoshop scipting, and I could write a standard Windows script that flushes out folder "A" every few minutes, but that would have to assume Pshop has found the file and processed it, which is a touch risky.

I'm sure someone must have done something like this before. I wondered if any of you had experience of this, or ideas how it might be achieved. Perhaps Bridge can help, I'm not sure. I could try to persuade the publisher to purchase Intellitune or something similiar, but I'm sure this can be achieved in Photoshop - for which they have many licenses already.

Many thanks in advance,

Simon
larsen67

Processing & housekeeping

Post by larsen67 »

You say that you are on Windows so Im NOT going to be of much help… You can however script Photoshop using ExtendScript & VB languages on that platform. (You will get more help with ExtendScript) Both of these can move/remove files from your system so B should prove no issue. The hurdle is A how you want the items to trigger your script process? I know how to do this on the mac but NOT on the PC… I think you are only going to be able to run at given time lapses…?

One possibility that I have not tried is to make a PS droplet to replace Folder A and have that call a script to move the file as part of an action step?
Mike Hale

Processing & housekeeping

Post by Mike Hale »

With Extendscript( javascript ) on Windows larsen67 is right. The script can open a file in A, process it then saveAs in B. It can then copy the file from A to C and delete the one in A.

The problem on Windows it how to run the script whenever a file gets added to A. Mac has that built in to the OS. For Windows you will need to get some type of 'Watched Folders' app to run the script when the watched folder changes( a file as been added ) or set up an Windows scheduled task or set up a BridgeTalk message on a timer.

The advantage to the 'watched folder' approach is the script will run only when needed. A script on a timer may run when there are no files to process.
NateO

Processing & housekeeping

Post by NateO »

Thought I'd revive this old thread instead of make a new topic...

I'm wondering what the proper syntax is for the copy method mentioned here. I've been trying to use fileobj.copy(outputFolder) (after first setting fileobj as the actual input file I'm dealing with), but whenever I try it nothing gets copied. Can anyone shed a little more light on the copy method? I want to do exactly what Mike is talking about: Open in A, process and save As in B, then copy from A to C. Thanks.

Nate
Mike Hale

Processing & housekeeping

Post by Mike Hale »

Code: Select allvar sourceFile =  new File('/c/incomming/t.png');// make a reference to the existing file
var destFile = new File('/c/processed/t.png');// make a reference to the new file. Note file will not exitst at this point.
var coppied = sourceFile.copy(destFile);// copy returns true if copy was made
if(coppied==true && destFile.exists) sourceFile.remove();// to be safe test copy results and that the new file exists
NateO

Processing & housekeeping

Post by NateO »

That looks like what I need, although I'm working with a folder full of files, not just one specific file, and the script is cycling through them. So for destFile I have Code: Select allvar destFile = new File("C:/PDFs/Photoshop/Backup/" + xxx); and I'm not sure what to put in for xxx. I've tried a few different things, but the most I can get is a document called [Document 3068767.pdf], where 3068767 is the name of the original file. Any ideas?

Nate
Mike Hale

Processing & housekeeping

Post by Mike Hale »

File.name will get you the name of the file with it's extension.

Code: Select allvar sourceFolder =  new Folder('/c/incomming');
var destFolder = new File('/c/processed');
var files = sourceFolder.getFiles();
for(var f =0; f<files.length;f++){
    if(!files[f].hidden){
        var destFile = new File( destFolder+'/'+files[f].name  );// combine the folder with the file name
        var coppied = files[f].copy(destFile);
        if(coppied==true && destFile.exists) files[f].remove();
    }
}
NateO

Processing & housekeeping

Post by NateO »

Ah that's perfect, thanks so much. I already had the recursive part figured out, but it's good to verify with your code that I did it the right way. It's been a while since I did any programming. Thanks again!

Nate
larsen67

Processing & housekeeping

Post by larsen67 »

Mike, I don't use the ESTK's file copy command. I found that it had issues with the file dates that I didn't want. Do you know if this is fixed in later versions or does it still result in a completely new file?
Mike Hale

Processing & housekeeping

Post by Mike Hale »

File.copy still creates a completely new file with a new date.

I don't know how one could copy/move a file in Extendscript without changing the date.