Copy link to clipboard
Copied
Hello everyone,
I have many folders with TIF files, NEF files (RAW Images), and XMP files.
but I want to play a batch action just on the TIF files.
Is that possible using Automate>Batch? Maybe script (jsx) of it?
Already tried Image Processor but that's not it.
Thanks in advance.
Copy link to clipboard
Copied
There is an Image Processor type Script one the web by Paul Riggott that can filter file types it processes. The script name is Picture Processor ie "Picture Processor.jsx" search the web for its download GitHub - Paul-Riggott/PS-Scripts: Photoshop Scripts
Copy link to clipboard
Copied
Thank for your help JJ, as always.
I found it and it's very nice, I looked around the Forums and found these two threads:
https://forums.adobe.com/thread/1246514
https://forums.adobe.com/thread/2203096
Based on it I wrote this script:
#target photoshop
// the script requires to select a folder, then it opens all the TIF or PSD inside it (including subfolders) and saves them as JPG quality 5.
var theFolder = Folder.selectDialog("select folder");
var fileandfolderAr = scanSubFolders(theFolder,/\.(tif|psd)$/i); //var fileandfolderAr = scanSubFolders(topFolder,/\.(jpg|tif|psd|bmp|gif|png|)$/i);
var fileList = fileandfolderAr[0];
for(var a = 0 ;a < fileList.length; a++)
{
var docRef = open(fileList);
var Name = app.activeDocument.name
var savePath = activeDocument.path;
var saveName = File(savePath + "/" + Name)
SaveJPEG(saveName,5);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
function scanSubFolders(tFolder, mask) { // folder object, RegExp or string
var sFolders = new Array();
var allFiles = new Array();
sFolders[0] = tFolder;
for (var j = 0; j < sFolders.length; j++){ // loop through folders
var procFiles = sFolders
.getFiles(); for (var i=0;i<procFiles.length;i++){ // loop through this folder contents
if (procFiles instanceof File ){
if(mask==undefined) allFiles.push(procFiles);// if no search mask collect all files
if (procFiles.fullName.search(mask) != -1) allFiles.push(procFiles); // otherwise only those that match mask
}else if (procFiles instanceof Folder){
sFolders.push(procFiles);// store the subfolder
scanSubFolders(procFiles, mask);// search the subfolder
}
}
}
return [allFiles,sFolders];
};
function SaveJPEG(saveFile, jpegQuality){
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality;
activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE);
};