Skip to main content
Inspiring
February 18, 2021
Answered

Can I record actions in InDesign

  • February 18, 2021
  • 4 replies
  • 2067 views

Is there a way to record an action in InDeisgn that would work with Photoshop? Rather than having to right click on an image, open in Photoshop, preform an action on my image then save and update the link in Indeisgn, can I do it with one action? So the InDesign action would open the selected image in Photoshop - do a photoshop action with a save and close, then update the link in InDesign. Just saves me a few clicks per image, but as I have thousands of images that need various actions performing on them it would save a lot of time.

This topic has been closed for replies.
Correct answer Frans v.d. Geest

Simple answer: no.

But maybe you/someone can script something 😉

4 replies

Participant
March 29, 2023

I am very sorry I block record button I am saying to say Please open records option 

rob day
Community Expert
Community Expert
February 22, 2021

 

Try this.

Edit the first two variables for your action—the action’s name and it’s group name—names are case sensitive.

 

EDIT: I added a loop to update the link after the Photoshop action runs

 

 

 

 

//Opens a selected image in Photoshop and runs an action
//Rob Day 2-21-2021

//#target indesign
#targetengine "session" 

//edit as needed names are case sensitive
var act = "Your Action"
var actgrp = "Your Action Group"

var doc = app.documents.item(0);
var s = doc.selection[0];

if (s == null || s.constructor.name != "Image") {
	alert("Please Direct Select an Image and Try Again.")
} else {
    var lnk = s.itemLink
    if (lnk.status == LinkStatus.NORMAL || lnk.status == LinkStatus.LINK_OUT_OF_DATE) {
        editImage(s.itemLink.filePath, act, actgrp);
    }else{
        alert("Image link is missing.")
        exit()
    }   
}


while (lnk.status != LinkStatus.NORMAL) {
    lnk.update();
}


/**
* Opens Photoshop via Bridgetalk and runs psScript 
*  the file path to open 
*  the action to run 
*  the actions group
*  value void
* 
*/
function editImage(s, act, actgrp){
    var bt = new BridgeTalk();  
    bt.target = "photoshop";
    bt.body = "var s = '"+s+"'; var act = '"+act+"'; var actgrp = '"+actgrp+"'; var func = " + psScript.toString() + "func();";

    bt.onResult = function(resObj) { }  
    bt.onError = function( inBT ) { alert(inBT.body); };  
    bt.send(8);  
      
    function psScript() {  
        var f = open(File(s)) 
        doAction(act, actgrp)
        f.save()
        f.close()
    }  
}

 

 

 

 

 

Jens Trost
Inspiring
February 21, 2021

Hi @Matthew5C62,
for the use case you mentioned, have a look at Zevrix's LinkOptimizer,

Frans v.d. Geest
Community Expert
Frans v.d. GeestCommunity ExpertCorrect answer
Community Expert
February 18, 2021

Simple answer: no.

But maybe you/someone can script something 😉