Copy link to clipboard
Copied
I use a custom script to batch process files into photoshop layers.
Every time I run the script I have to manually edit the folder path in the script to save the new images in a new folder.
Can a UI dialog be implemented into a script used for batch file processing?
The UI dialog:
Enter folder path
Remember the last folder path used
When the scripts runs the UI dialog displays. After the user enters the folder path the the scripts batch processes a folder of images.
Copy link to clipboard
Copied
Instead of entering the path manually would a folder selection dialog not be more convenient?
var theFolder = Folder.selectDialog ("select folder");
if (theFolder) {
var theFiles = theFolder.getFiles(/\.(jpg|tif|eps|psd)$/i)
};
Copy link to clipboard
Copied
I try the Folder dialog but the Bridge script does not complete when using this option.
I would like to save the new tiff file in the same directory with the stack images.
Is there a way to omit the save location path to save the tiff in the same directory as the Bridge stack images?
var stackFileName = app.activeDocument.name;
var saveFile = new File('~/desktop/pscc test/'+stackFileName+' ');
app.activeDocument.saveAs(saveFile, tifOpts, true);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
Copy link to clipboard
Copied
There is a Bridge Scripting Forum, too, maybe you should post there.
Copy link to clipboard
Copied
And you can save the data by putting it to an action descriptor and saving to custom options. I have assumption about JSON encoding, but many other ways of stuffing things to action descriptors are possible.
savePreferences: function (metadata) {
var metadata_json = serialize_to_json(metadata)
var desc = new ActionDescriptor()
desc.putData(0, metadata_json)
app.putCustomOptions (APP_ID, desc, true)
},
loadPreferences: function () {
try {
var desc = app.getCustomOptions (APP_ID)
if (desc) {
var metadata_json = desc.getData(0)
if (metadata_json) {
eval("var result = (" + metadata_json + ")")
if (result) {
return result
}
}
}
} catch (e) {
var foo = e.message
}
},