Hi
I need to add in a script only the " include all subfolders "
the script is the " Manual batch "
https://github.com/cgencer/ps-scripting ... al%20Batch
it would be possible?
how to edit a script
Re: how to edit a script
Hi,
If you want to apply a script to the photos that are in subfolders, I think that the best way is to use a recursive function.
Here is an example I wrote to extract width and height of the photos found in a folder (and its subfolders, of course). Hope it will help.
If you want to apply a script to the photos that are in subfolders, I think that the best way is to use a recursive function.
Here is an example I wrote to extract width and height of the photos found in a folder (and its subfolders, of course). Hope it will help.
Code: Select all
// Enables double clicking from the Macintosh Finder or the Windows Explorer
#target photoshop
app.bringToFront();
var inputFolder = Folder.selectDialog("Select the top folder where your images are : ");
if (inputFolder != null) {
filesArray = scanFolder(inputFolder);
if (filesArray.length > 0)
{
for (i = 0;i<filesArray.length;i++)
{
docRef = filesArray[i];
open(docRef);
imgWidth = app.activeDocument.width;
imgHeight = app.activeDocument.height;
alert(imgWidth+" x " +imgHeight);
}
}
}
alert("Done !");
// Recursive function
function scanFolder(folder) {
var filesArray = [],
fileList = folder.getFiles(),i, file;
for (i = 0; i < fileList.length; i++) {
file = fileList[i];
if (file instanceof Folder) {
filesArray = filesArray.concat(scanFolder(file));
}
else if (file instanceof File && file.name.match(/\.(jpg|tif|psd|bmp|gif|png|)$/i)) {
filesArray.push(file);
}
}
return filesArray;
}