Copy link to clipboard
Copied
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.
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 f
...
Copy link to clipboard
Copied
You already know this is a less than ideal workflow...
Can you possibly leave the images linked until editing is finished?
Copy link to clipboard
Copied
I don’t see how...
You’ll probably need a script that silently unembeded the file, display the import option, than embed the file.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
How about placing the image, setting the layer(s), and then embedding it?
Copy link to clipboard
Copied
Folks! @Eugene Tyson is asking for changing imported PAGE of the PDF. Not the Layers visibility.
Copy link to clipboard
Copied
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."
Copy link to clipboard
Copied
You’re right... My bad!
Copy link to clipboard
Copied
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
* @Param 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;
}
Copy link to clipboard
Copied
Outstanding - works perfectly!
Thank you so much
Copy link to clipboard
Copied
One small thing - it needs to link back to the original - any chance of a dialog to navigate to the original file?
Copy link to clipboard
Copied
Hi Eugene, I was assuming the reason you want to keep the link embedded, was because the original might not exist anymore, or might not exist in the future. An embedded asset still has the original file path, so this will work if it exists, but will throw an error if it doesn’t:
editEmbedLayers()
function editEmbedLayers(){
var doc = app.activeDocument
try {
var lnk = doc.selection[0].itemLink;
}catch(e) {
alert("Please Direct Select an Embedded Item")
return
}
try {
var tf = File(lnk.filePath).parent
lnk.unembed(File(tf))
}catch(e) {
alert("Original Not Found")
return
}
var olo = app.menuActions.itemByID(37889)
if(olo.enabled){
olo.invoke();
};
lnk.unlink();
}
Copy link to clipboard
Copied
Ok thanks - I'll give it a shot next week.
This is fantastic by the way - thank you so much.
Copy link to clipboard
Copied
Thanks for the great replies from everyone - really appreciate it!
I know it's unusual - but it's the way it is.