Skip to main content
Participating Frequently
Jan. 13, 2023 1:47 PM UTC
Frage

script no longer works in indesign 2023

Hi all,

this is an essential script (from abracadabraPDF.net) which i'm using for years, until now.....

after the indesign update 2023 the script doesn't do anything anymore :-((

Would be great if someone could debug this:

 

myDoc = app.activeDocument;
 
if( myDoc.selection.length == 0 ){err("PDFoptions editor - offert par abracadabraPDF.net\r\r\rThere's no selection!\r\rIl n'y a pas de s\u00E9lection active !");}
 
if( myDoc.selection[0].constructor.name != "PDF" ){
//Teste si selection existante
try {
if (myDoc.selection[0].contentType == ContentType.graphicType){
//Teste si contenu est PDF ou non
try {
if (myDoc.selection[0].allGraphics[0].constructor.name == "PDF"){
placePDF(myDoc.selection[0].allGraphics[0]);
} else {
err("PDFoptions editor - offert par abracadabraPDF.net\r\r\rNo PDF content embedded.\r\rIl n'y a pas de PDF incorpor\u00E9.");
}
} catch (e){
err("PDFoptions editor - offert par abracadabraPDF.net\r\r\rNo PDF content embedded.\r\rIl n'y a pas de PDF incorpor\u00E9.");
}
} else {
err("PDFoptions editor - offert par abracadabraPDF.net\r\r\rSelect an imported PDF content.\r\rS\u00E9lectionnez un objet contenant un PDF import\u00E9.");
}
} catch (e){
err("PDFoptions editor - offert par abracadabraPDF.net\r\r\rSelect an imported PDF content.\r\rS\u00E9lectionnez un objet contenant un PDF import\u00E9.");
}
 
 
} else {
placePDF(myDoc.selection[0]);
}
 
exit();
 
 
function placePDF(n){
try {
 
//versions ulterieuresà CS4
myDoc.selection[0].place(n.itemLink.filePath,1, undefined);
 
} catch (e){
//err("Unknown error!");
}
}
 
 
 
function err(e){
alert(e);
exit();
}

 

Dieses Thema wurde für Antworten geschlossen.

17 Antworten

Marc Autret
Legend
Jan. 16, 2023 10:24 AM UTC

Hi @Ton_T 

 

The script is a bit old but should work in general. Maybe nested try..catch cause problems in some versions (?)

 

Here is a quick rework, just in case:

 

https://gist.github.com/indiscripts/4fa2401237cefba65e6dc53336d6d8e7

 

Best,

Marc

Übersetzen
Ton_TAutor
Participating Frequently
Jan. 17, 2023 8:32 AM UTC

Hi Marc,

thanks, this one almost does it, only issue now is:

the link is a pdf on a different mac/server, now the script says pdf is missing....

if the link is placed on the desktop, the script seems to work fine

any solutions ?

Übersetzen
Marc Autret
Legend
Jan. 17, 2023 6:54 PM UTC

@Ton_T 

 

Maybe you can just comment line 25:

// if( !(ff && File(ff).exists) ) throw "PDF File is missing. You probably should relink.";

 

Not sure how remote files should be tested. Is the place() method robust enough to address this case? I don't know.

 

Best,

Marc

Übersetzen
Loic.Aigon
Legend
Jan. 14, 2023 11:00 PM UTC

You should contact the author so he may possibley fix it if needed.

Übersetzen
Ton_TAutor
Participating Frequently
Jan. 17, 2023 2:13 PM UTC

Hi Loic,

done that, he has done all he could do for me.....

Übersetzen
rob day
Community Expert
Community Expert
Jan. 13, 2023 3:30 PM UTC

the script doesn't do anything anymore

 

Hi @Ton_T , What is it supposed to do? Seems like all it’s doing is relinking the selection when it is a PDF

Übersetzen
Ton_TAutor
Participating Frequently
Jan. 17, 2023 8:28 AM UTC

Hi Rob,

yes it should relink and give you the choice of new/different pdf place options

Übersetzen
rob day
Community Expert
Community Expert
Jan. 17, 2023 12:47 PM UTC

Did you try the code I posted?

Übersetzen
Inspiring
Jan. 13, 2023 2:57 PM UTC

Assuming that you're not seeing an error message, try uncommenting this line:

 

//err("Unknown error!")
 
 and make it say:
 
err (e + e.line);
 
 It won't fix anything but at least you'll know what the errror is and where it occurs. 
Übersetzen
Ton_TAutor
Participating Frequently
Jan. 17, 2023 8:39 AM UTC

thanks, 

"can't find the linked source"

seems approx the same error as below 

Übersetzen
Mike Witherell
Community Expert
Community Expert
Jan. 13, 2023 1:52 PM UTC

I always put any script in a sub-folder named, for example, "Version 17.0 Scripts" (for 2022) or whatever version number relates to the year and version your script was first produced. Sometimes it works!

Übersetzen
Mike Witherell
Ton_TAutor
Participating Frequently
Jan. 13, 2023 3:06 PM UTC

thanks Mike,

the script is in the directory preferences/Adobe InDesign/version 18.0/nl_NL/Scripts/Scripts Panel

changing the directory has no effect unfortunately....

Übersetzen
rob day
Community Expert
Community Expert
Jan. 13, 2023 3:55 PM UTC

Is it to show the place options for a PDF that’s already placed? Maybe try this:

 

 

displayOptions()

/**
* Shows a selected PDF’s place options 
* @ return value 
* 
*/
function displayOptions(){
    var sel = app.activeDocument.selection;
    if( sel.length == 0 ){
        alert("There's no selection");
        return
    }
    
    if( sel[0].constructor.name != "PDF" && sel[0].allPageItems.length > 0){
        var pi = sel[0].allPageItems
        var i = pi.length; 
        while (i--) if (pi[i].itemLink.isValid && pi[i].constructor.name == "PDF") {pi[i].parent.place(pi[i].itemLink.filePath, true)}  
    }else{
        sel[0].parent.place(sel[0].itemLink.filePath,true);
    }
}

 

Übersetzen