I wish the ToC generator would signal

Adobe Community Professional ,
May 13, 2022 May 13, 2022

Copy link to clipboard

Copied

Hi gang,

Is there a listener script existing that pops up when you Print or Export to PDF and messages the question: "Did you update the Table of Contents?"

 

That is the only way I can think of to make sure the InDesigner generates a current and correct ToC.

 

Or perhaps you have a good idea?

Mike Witherell
TOPICS
How to

Views

54

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 16, 2022 May 16, 2022

Copy link to clipboard

Copied

LATEST

Here is what I found and edited so far:

#targetengine "session"
// An event listener performs a preflight check before printing. 
// If preflight fails, it cancels the print job.
main();
function main(){
    var myEventListener = app.eventListeners.add("beforePrint",
        myBeforePrintHandler);
}
function myBeforePrintHandler(myEvent){
//The parent of the event is the document.
    var myDocument = myEvent.parent;
    if(myPreflight(myDocument) == false){
        myEvent.stopPropagation();
        myEvent.preventDefault();
        alert
            (
            "Document did not pass Preflight check."+"\r"+
            
            "Did you Edit > Spelling > Check Spelling?"+"\r"+

            "Did you Layout > Update Table of Contents?"+"\r"+

            "Did you File > Save As a backup copy?"
            );
    }
    else{alert
            (
            "Document passed Preflight check. Ready to print."+"\r"+

            "Did you Edit > Spelling > Check Spelling?"+"\r"+

            "Did you Layout > Update Table of Contents?"+"\r"+

            "Did you File > Save As a backup copy?"
            );
        }
    function myPreflight(myDocument){
        var myPreflightCheck = true;
        var myFontCheck = myCheckFonts(myDocument);
        var myGraphicsCheck = myCheckGraphics(myDocument);
        alert("Fonts: " + myFontCheck + "\r" + "Links:" + myGraphicsCheck);
        if((myFontCheck == false)||(myGraphicsCheck == false)){
            myPreflightCheck = false;
        }
        return myPreflightCheck;
    }
    function myCheckFonts(myDocument){
        var myFontCheck = true;
        for(var myCounter = 0; myCounter < myDocument.fonts.length; 
            myCounter ++){
            if(myDocument.fonts.item(myCounter).status != FontStatus.installed){
                myFontCheck = false;
            }
        }
        return myFontCheck;
    }
    function myCheckGraphics(myDocument){
        var myGraphicsCheck = true;
        for(var myCounter = 0; myCounter < myDocument.allGraphics.length;
        myCounter++){
            var myGraphic = myDocument.allGraphics[myCounter];
            if(myGraphic.itemLink.status != LinkStatus.normal){
                myGraphicsCheck = false;
            }
        }
        return myGraphicsCheck;
    }
}

This is from the ExtendScript Guide from about 10 years ago.

What I would like to have it also do is trigger the screen messages when someone does an Export to PDF or PDF  interactive.

Can someone advise me on how to expand this beyond listening for the Print command?

Mike Witherell

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines