Action/Script or something else to watch folder for new photos and run action on them.

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

flashpack
Posts: 1
Joined: Mon Aug 22, 2016 3:46 pm

Action/Script or something else to watch folder for new photos and run action on them.

Post by flashpack »

Hey!

Is it possible to run Action/Script or something similar to watch folder for new photos and then run action on them?

I'm trying to use it as a add on to photobooth to edit 2-4 new captured photos and then use them all to create GIF, video, mixed them together etc. to create something more interesting.

I'm able to use droplets with my capture software but I could also run some script, or other software to make it all in a background and then share content with a different software.

I couldn't find anything online and thought maybe you could come up with some idea.

Many thanks!
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: Action/Script or something else to watch folder for new photos and run action on them.

Post by Kukurykus »

I played with some script I still have, but I'm not sure is it a little part of it, as I changed it to see how it works but it worked with Bridge and Photoshop. So everytime a file changed you knew it in no time or maybe even that was opened in Photoshop or lanched some action. I complely don't remember now and I'm sorry have no time to focus on. It's all I have (probably copied from some forums):

Code: Select all

#target photoshop

main();
function main(){
if($.getenv('HotFolder') == null){
alert("Please re-start the Hot Folder in Bridge!");
return;
}
var hotFolder = Folder($.getenv('HotFolder'));
//create a couple of folders if they do not exist
var ProcessedFolder = Folder(hotFolder +"/Processed");
if(!ProcessedFolder.exists) ProcessedFolder.create();
var OriginalsFolder = Folder(hotFolder +"/Originals");
if(!OriginalsFolder.exists) OriginalsFolder.create();
//get a list of files in the hot folder
var fileList = hotFolder.getFiles(/\.(jpg|tif|psd|cr2,nef)$/i);
//This is where all the work is done
for(var z in fileList){
//Add your own code to suit your needs
//Example code ....
//open each file
open(fileList[z]);
var Name = decodeURI(app.activeDocument.name).replace(/\.[^\.]+$/, '');
//run an action ?
//app.doAction('atn name', 'atnSet name');
//resize
FitImage( 1024, 600 );
//save processed file
var saveFile = File(ProcessedFolder +"/" + Name + ".psd");
SavePSD(saveFile);
//close file
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
//move file to Originals folder
fileList[z].rename(File(OriginalsFolder + "/" + fileList[z].name));
}
}
function SavePSD(saveFile){
psdSaveOptions = new PhotoshopSaveOptions();
psdSaveOptions.embedColorProfile = true;
psdSaveOptions.alphaChannels = true;
psdSaveOptions.layers = true;
activeDocument.saveAs(saveFile, psdSaveOptions, true, Extension.LOWERCASE);
}
function FitImage( inWidth, inHeight ) {
if ( inWidth == undefined || inHeight == undefined ) {
alert( "FitImage requires both Width & Height!");
return;
}
var desc = new ActionDescriptor();
var unitPixels = charIDToTypeID( '#Pxl' );
desc.putUnitDouble( charIDToTypeID( 'Wdth' ), unitPixels, inWidth );
desc.putUnitDouble( charIDToTypeID( 'Hght' ), unitPixels, inHeight );
var runtimeEventID = stringIDToTypeID( "3caa3434-cb67-11d1-bc43-0060b0a13dc4" );
executeAction( runtimeEventID, desc, DialogModes.NO );
}
and some link to other version(?): https://forums.adobe.com/thread/2137723