1

I need to go through an InDesign document a convert all the auto page number special characters to their actual value.

So on each page, find a auto page number symbol and replace it with the value it evaluates to.

I haven't been able to find a script that does that - nor am I an inDesign scripting expert.

Has anyone got a solution for this?

7

Ok, I think I've worked it out.

main();
function main(){
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;

    app.findGrepPreferences.findWhat="~N";

    var FindGrep=app.activeDocument.findGrep();
    for(i=0; i<FindGrep.length; i++)
    {
        var item = FindGrep[i];
        var page = item.parentTextFrames[0].parentPage;
        item.contents = page.name;
    }

    alert("done");

}

Struggled to find any valuable documentation from Adobe.

This really helped: http://jongware.mit.edu/idcs5/

As well as this SO question: Get current page number in InDesign CS5 from Javascript

Edit: If your page numbering is in a master, you will need to "override all page master items" (check the pages palette)

Edit 2: This worked on inDesign 5.5 (not sure about 6)

Edit 3: Works also on InDesign CC

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.