What's new

Automate Batch by jumping


idjev

Member
Messages
10
Likes
0
I want to add a watermark to the photos in the folder, but by jumping
I could not do it with actions
is it possible... Thanks
Ekran+Resmi+2017-11-06+12.11.36.png
 

Paul MR

The Script Master
Messages
382
Likes
206
Yes this is possible if you want to process all odd numbered files.
This example will prompt for the input folder and write the output files to a folder called processed off the input folder.
N.B. You need to change the line:-
Code:
doAction("ActionName","ActionSet");
To reflect the actual name of your action!
Code:
#target photoshop;
app.bringToFront();

main();
function main(){
var inputFolder= Folder.selectDialog ("Please select folder to process");
if(inputFolder == null) return;
var outputFolder = Folder(inputFolder + "/processed");
if(!outputFolder.exists) outputFolder.create();
var filelist = inputFolder.getFiles("*.jpg");
for (var x in filelist){
var Name = filelist[x].name.replace(/\.[^\.]+$/, '');
var num = Name.match(/(\d+)[^\d]*$/)[1];
if(Number(num)%2){
    //odd number
    app.open(filelist[x]);
    //modify the line below to show your actionname and action set
    //this is your action for the watermark
    doAction("ActionName","ActionSet");
    var saveFile = File(outputFolder + "/" + filelist[x].name);
    SaveJPEG(saveFile,8);
    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);  
    }
}
};
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);
};
 

idjev

Member
Messages
10
Likes
0
input Folder : .tif and jpg
output Folder /processed : Save .tif is it possible ?
.tif options > ımage compression > None
Thank you very much
 
Last edited:

Paul MR

The Script Master
Messages
382
Likes
206
Please try this...
Code:
#target photoshop;
app.bringToFront();

main();
function main(){
var inputFolder= Folder.selectDialog ("Please select folder to process");
if(inputFolder == null) return;
var outputFolder = Folder(inputFolder + "/processed");
if(!outputFolder.exists) outputFolder.create();
var filelist = inputFolder.getFiles(/\.(jpg|tif)$/i);
for (var x in filelist){
var Name = filelist[x].name.replace(/\.[^\.]+$/, '');
var num = Name.match(/(\d+)[^\d]*$/)[1];
if(Number(num)%2){
    //odd number
    app.open(filelist[x]);
    //modify the line below to show your actionname and action set
    //this is your action for the watermark
    doAction("ActionName","ActionSet");
    var saveFile = File(outputFolder + "/" + Name + ".tif");
    SaveTIFF(saveFile,8);
    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);  
    }
}
};
function SaveTIFF(saveFile){
tiffSaveOptions = new TiffSaveOptions(); 
tiffSaveOptions.embedColorProfile = true; 
tiffSaveOptions.alphaChannels = true; 
tiffSaveOptions.layers = true;
tiffSaveOptions.imageCompression = TIFFEncoding.NONE; 
activeDocument.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE); 
};
 

Paul MR

The Script Master
Messages
382
Likes
206
Sorry I do not understand, are you wanting to check letters as well? If so that would take a lot to do.
 

idjev

Member
Messages
10
Likes
0
Teacher Paul Mr
4 jumping,
not having to save a different folder (record on)
mixed file names available (number - letter)
Ekran Resmi 2017-11-08 14.45.39.png
I made you tired sorry .... thank you very much for your help
 

Top