Skip to main content
Inspiring
November 23, 2011
Answered

Processing of recent images in a folder which contains old images also?

  • November 23, 2011
  • 1 reply
  • 1176 views

Hi,

     We have a Studio setup. Once we shoot a product, the image will be saved in today's (23.11.11)  folder.

We have to open Photoshop and then select an appropriate script for the images. The script will process all the images in the folder. -- (Current Process)

We would like to know, " How the Script should open and automatically process the images, it should be able to identify any image from the present folder and the current time. -- (Future State).

Expecting your response.

thanks,

Rajiv.S

This topic has been closed for replies.
Correct answer mangalarajiv

You could give this a try (it uses the modified-property, if you want to use created just change line 13 accordingly):

// get the newest file/s from a folder;

// 2011, use it at your own risk;

var theFolder = Folder.selectDialog ("select folder");

if (theFolder != null) {

// set the number of the most recent files to get;

var theNumber = 2;

// get the files;

var theFiles = theFolder.getFiles(/\.(jpg|tif|eps|psd)$/i);

var modifiedDate = new Array;

var theNewest = new Array;

for (var m = 0; m < theFiles.length; m++) {

          var theFile = theFiles;

          modifiedDate.push( [theFile, File(theFile).modified.getTime()] )

          };

// sort by date;

modifiedDate.sort(sortByDate);

for (var n = 0; n < theNumber; n++) {

          theNewest.push(modifiedDate[0])

          };

alert ("the "+theNumber+" most recently changed files are\n"+theNewest.join("\n"));

};

////// to sort a double array by sam, http://www.rhinocerus.net/forum/lang-javascript/ //////

function sortByDate(a,b) {

if (a[1]<b[1]) return -1;

if (a[1]>b[1]) return 1;

return 0;

};


Hi,

     I tried this one. It works......

thanks for your co-operation,

thank you so much again.

thanks,

rajiv.s

1 reply

c.pfaffenbichler
Community Expert
Community Expert
November 23, 2011

Sorry, I don’t fully understand your question, I'm afraid.

What images should the Script identify and process based on what property?

Inspiring
November 23, 2011

Hi,

     We are doing product photography. We used to shoot with white background in which a script that we created will automatically knock out the background and save it as jpg. This is the current process we handle.

To extend little more down in a process. We would like to create a script which has the ability to get the recent image shot in the image and process it in the photoshop automatically. Is there any way to get an image to photoshop by the data created. 

thanks,

Rajiv.S

c.pfaffenbichler
Community Expert
Community Expert
November 23, 2011

File has the Properties »created« and »modified« which a Script could assess and compare.

So if you use Folder-selection in the Script it should be possible to have it process only the newest file/s from that folder.

As as aside: Don’t you save the layered files after knocking out, too?

Seems a shame to flatten and use a destructive format if not absolutely necessary.