The FTBatch.jsx script provides a rudimentary facility for breaking up
a large processing job in to smaller components. For instance, if you have to
process 1000 images but PS fails with an out-of-memory problem after 150
images, you can use this script to process 100 images, restart PS, process the
next 100 images, etc... until you're finished. Restarting PS will usually
help you avoid memory-related problems.
FTScript and FTBatch require that Bridge be running for them to work.
FTScript.jsx is a low-level interface. It needs to be loaded at startup by
Bridge and Photoshop.
Copy that FTScript.jsx to one of the following folders:
On WinXP CS2: %CommonProgramFiles%\Adobe\StartupScripts
On WinXP CS3: %CommonProgramFiles%\Adobe\Startup Scripts CS3\Adobe Photoshop
On OSX CS2: /Library/Application Support/Adobe/StartupScripts
On OSX CS3: /Library/Application Support/Adobe/StartupScripts CS3/Adobe Photoshop
FTScript maintains configuration information in the file ~/ftscript.ini.
FTBatch.jsx is a higher-level interface. It is suitable for use when you
are simply processing a list of files. This script maintains the list of
files in the file ~/ftbatch.cfg.
FTBatchTest.jsx is a demo script that uses the FTBatch interface. It process files from the folder ~/ximages. The processing is merely an alert. The script is setup to restart PS after 7 images have been processed.
Code: Select all//
// FTBatchTest.jsx
//
//@show include
//@includepath "/c/Program Files/Adobe/xtools;/Developer/xtools"
//@include "xlib/FTBatch.jsx"
//
// This method must be defined in the top-level
// script file
//
FTBatch.getScriptFileName = function() {
var dbLevel = $.level;
$.level = 0;
var path = undefined;
try {
some_undefined_variable;
} catch (e) {
path = e.fileName;
}
$.level = dbLevel;
return path;
};
// This is our reference to our image folder.
// It is not used by FTBatch. Point it to a folder with 10-20 jpg files
FTBatch.imageFolder = "~/ximages";
//
// This function must be defined to return the complete
// list of files to be processed
//
FTBatch.prototype.init = function() {
var res = [];
var folder = new Folder(FTBatch.imageFolder);
var files = folder.getFiles("*.jpg");
return files;
};
//
// This propery may be overridden as needed. The default is 10
// files to be processed before a restart
//
FTBatch.prototype.batchSize = 7;
//
// This method will be called for each file to be processed
//
FTBatch.prototype.processFile = function(file) {
alert("File: " + file.absoluteURI);
return true;
};
// Create a new instance
var ftest = new FTBatch();
// Start (or continue) processing
ftest.main();
// EOF
I've used variants of this framework in several projects. This version is different than previous releases in that it supports CS2 and CS3.
-X