Skip to main content
Inspiring
September 25, 2023
Question

Need a script for InDesign that runs a batch process to adjust my photos in photoshop.

  • September 25, 2023
  • 2 replies
  • 433 views

Is there a script for InDesign that will open all my images in photoshop - run a batch process I have made to convert all images, adjust the levels, save and close. I know I can do it in photoshop almost just as quick and them update the links in InDesign, but wondered if it could be done to save a few minutes work.

This topic has been closed for replies.

2 replies

rob day
Community Expert
Community Expert
September 25, 2023

Hi @Matthew5C62 , Here’s a Bridgetalk example that will open any image links into Photoshop and run an action—edit the doAction line as needed.:

 

 

 

 



adjustImages()

var np;
function adjustImages(){
    var bt = new BridgeTalk();  
    bt.target = "photoshop"; 
    if (app.documents.length > 0) {
        var lnks = app.documents[0].links;
        for (var i = 0; i < lnks.length; i++){
            if (lnks[i].parent.constructor.name == "Image"  ) {
                runAction(lnks[i].filePath, bt)
                while (lnks[i].status != LinkStatus.NORMAL) {lnks[i].update()}
            }
        };   
    } else {
        alert("No Documents Open")
        return
    }
}


/**
* Run an Action on open image
* @ param Link’s file path 
* @ param Bridgetalk instance 
* return new file path 
*/

function runAction(pa, bt){
    bt.body = psScript.toString() + "\rpsScript('"+pa+"');";
    bt.onError = function( inBT ) { alert(inBT.body); };  
    bt.onResult = function(resObj) { 
       np = resObj.body
    } 
    bt.send(1000); 
    function psScript(pa) {  
        app.bringToFront();
        var of = open (File(pa));
        //edit this line to your action and its group, string is case sensitive must be exact.
        doAction ("ACTION NAME", "ACTION GROUP");
        try {
            of.close(SaveOptions.SAVECHANGES);
        }catch(e) {}  
        
        return pa     
    }  
};


  

 

 

 

 

Inspiring
September 25, 2023
Thanks, I will give it a try.
brian_p_dts
Community Expert
Community Expert
September 25, 2023

It could be written using BridgeTalk, but you're probably better off just packaging the INDD file and running the batch process on that packaged folder. Not aware of any existing solution.