Hello Charles,
Currently I’m using Adobe bridge as batch manager based on this watch folder script:
It uses: if (BridgeTalk.getStatus(“photoshop”) == “IDLE”) to queue the next file
//The Hot Folder will be the folder where you run the script.
//You should be able to use bridge as normal.
if( BridgeTalk.appName == "bridge" ) {
var newMenuHF = new MenuElement( "menu", "Hot Folder", "after Help", "hotFolder" );
var runHotFolder= new MenuElement( "command", "Start Hot Folder", "at the end of hotFolder" , "hotFolderxx" );
}
runHotFolder.onSelect = function () {
var thisFolder = encodeURI(Folder(app.document.presentationPath));
var cmd = "$.setenv('HotFolder','" +thisFolder+ "');";
var bt = new BridgeTalk();
bt.target = "photoshop";
bt.body = cmd;
bt.send();
processHotFolder = function(){
/* files to look for */
if(Folder(thisFolder).getFiles(/\.(jpg|tif|psd|cr2,nef)$/i).length <1) return;
if (BridgeTalk.getStatus("photoshop") == "IDLE"){
bt.target = "photoshop";
bt.body = "var PShotFolder = " + PShot.toSource() + "; PShotFolder();";
bt.send();
}
}
BottomBar = app.document.navbars.filesystem.bottom;
BottomBar.height = 30;
BottomBar.visible = true;
BottomBar.bu1 = BottomBar.add ('button',[5,5,300,25],'Stop Hot Folder');
id = app.scheduleTask( "processHotFolder()", 2000, true );
BottomBar.bu1.onClick=function(){
app.cancelTask (id);
BottomBar.visible = false;
}
function PShot(){
var SCRIPTS_FOLDER = decodeURI(app.path + '/' + localize("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts"));
var hotFile = new File(SCRIPTS_FOLDER + "/PShotFolder.jsx");
$.evalFile (hotFile);
}
};
Photoshop then picks up the file and continues (based) on this script: PShotFolder.jsx
In my version of this script I added lots of texture extractions code based in the pdf file names. (not visible here)
#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 );
}
My goal is to replace Adobe Bridge with Deadline so I can manage the queue and use multiple hosts.
The flow would be:
- Deadline picks up pdf files from watch folder and adds them to queue
- Deadline checks hosts if Photoshop is Idle (possible?)
- Deadline sends file to Photoshop on client
- Photoshop executes its script until idle
- Deadline flags file as done
For progress indicators I could add some code in the Photoshop script that Deadline could interpret.
It’s the first time I am building some flow in Deadline so any direction would be great!
Thx!
Kind regards,
Danny