Skip to main content
Community Expert
August 18, 2022
Answered

Invoke Show Options for embedded images?

  • August 18, 2022
  • 7 replies
  • 1042 views

As the title says, can you call up the Show Options for embedded images?

 

I can't change the workflow. All images need to be embedded. So that won't change.

 

But sometimes I need to call a different layer in the .ai file the pdf file and I can't access without unembedding, updating the layer, and reembed.

 

Just wondering is there a way to leave the image embedded and call up the layers like you see the show options like when you are placing an image for the first time.

 

 

 

This topic has been closed for replies.
Correct answer rob day

Hi Eugene, does this script work for you—it expects the embedded link to be selected:

 

 

var d = new Date
var ct =  "/IDlink-" + d.getTime()+ "/";
var tf = makeTemp(ct)
try {
    var lnk = app.activeDocument.selection[0].itemLink;
    lnk.unembed(File(tf))
}catch(e) {
   alert("Please Direct Select an Embedded Item")
}  
var olo =  app.menuActions.itemByID(37889)
if(olo.enabled){  
    olo.invoke();  
}; 
lnk.unlink();



/*
* Tries to create a folder in the OS Temp directory then uses the ID file’s 
* parent directory as a fallback
* @9397041 the folder name 
* @Return true if a folder is created 
*/

function makeTemp(n){
    var tf, cf;
    tf = new Folder(Folder.temp + n);
    cf = tf.create();
    
    //cf retuns false if the temp folder is not created
    if (!cf) {
        if (!app.activeDocument.saved) {
            alert("Please Save Your Document and Try Again");
        } else {
            //the OS temp folder was not created
            var dp = app.activeDocument.filePath;
            tf = new Folder(dp + "/" + n);
            cf = tf.create()
        }
    } 
    return tf;
}


 

7 replies

Community Expert
August 19, 2022

Thanks for the great replies from everyone - really appreciate it! 

I know it's unusual - but it's the way it is.

rob day
Community Expert
rob dayCommunity ExpertCorrect answer
Community Expert
August 18, 2022

Hi Eugene, does this script work for you—it expects the embedded link to be selected:

 

 

var d = new Date
var ct =  "/IDlink-" + d.getTime()+ "/";
var tf = makeTemp(ct)
try {
    var lnk = app.activeDocument.selection[0].itemLink;
    lnk.unembed(File(tf))
}catch(e) {
   alert("Please Direct Select an Embedded Item")
}  
var olo =  app.menuActions.itemByID(37889)
if(olo.enabled){  
    olo.invoke();  
}; 
lnk.unlink();



/*
* Tries to create a folder in the OS Temp directory then uses the ID file’s 
* parent directory as a fallback
* @9397041 the folder name 
* @Return true if a folder is created 
*/

function makeTemp(n){
    var tf, cf;
    tf = new Folder(Folder.temp + n);
    cf = tf.create();
    
    //cf retuns false if the temp folder is not created
    if (!cf) {
        if (!app.activeDocument.saved) {
            alert("Please Save Your Document and Try Again");
        } else {
            //the OS temp folder was not created
            var dp = app.activeDocument.filePath;
            tf = new Folder(dp + "/" + n);
            cf = tf.create()
        }
    } 
    return tf;
}


 

Community Expert
August 19, 2022

Outstanding - works perfectly!

 

Thank you so much

 

jctremblay
Community Expert
Community Expert
August 18, 2022

Folks! @Eugene Tyson is asking for changing imported PAGE of the PDF. Not the Layers visibility.

brian_p_dts
Community Expert
Community Expert
August 18, 2022

From Eugene (emphasis mine): "But sometimes I need to call a different layer in the .ai file the pdf file and I can't access without unembedding, updating the layer, and reembed."

jctremblay
Community Expert
Community Expert
August 18, 2022

You’re right... My bad!

Dave Creamer of IDEAS
Community Expert
Community Expert
August 18, 2022

How about placing the image, setting the layer(s), and then embedding it?

 

David Creamer: Community Expert (ACI and ACE 1995-2023)
brian_p_dts
Community Expert
Community Expert
August 18, 2022

You can get a list of the graphic's layers with this (assuming the graphic frame is selected):

alert(app.selection[0].graphics[0].graphicLayerOptions.graphicLayers.everyItem().name);

You could theoretically write a script to display the names of the layers, and then change the GraphicLayer object's properties, all of which are available here: https://www.indesignjs.de/extendscriptAPI/indesign-latest/#GraphicLayer.html#d1e323320

 

Of course, this is not a trivial matter, and a different workflow probably would be best. But you could theoretically toggle layer visibility, etc. through script. 

 

brian_p_dts
Community Expert
Community Expert
August 18, 2022

You'd probably have to have the script unembed anyways. Have you tried unembedding, selecting the graphic objet (not the frame), and going to Object >> Object Layer Options to toggle? That's essentially what a script could mimic. 

jctremblay
Community Expert
Community Expert
August 18, 2022

I don’t see how... 

You’ll probably need a script that silently unembeded the file, display the import option, than embed the file.

Peter Spier
Community Expert
Community Expert
August 18, 2022

You already know this is a less than ideal workflow...

Can you possibly leave the images linked until editing is finished?