• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Rename every page to a text field that page

Explorer ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

Hi all,

is there any way i can rename every page to a text field on the pages.

On every page i have an article-number and i need to export every page to a seperate pdf files (thanks adobe for that last update!) where that number is in the pdf-filename.

I can do that manually but the amount of pages is getting rather big. so is there a way i can automate this within indesign?

any scripts?

thanks

TOPICS
Scripting

Views

2.7K

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

correct answers 1 Correct answer

Advocate , Jul 03, 2018 Jul 03, 2018

Updated one.

var c = 0;    var myStyle = "test";

while(c < app.activeDocument.pages.length){

    var found = findMyTextStyle(myStyle, app.activeDocument.pages);

    if(found==null){

        found = "1";

        }

    try{

        var sec = app.activeDocument.sections.add(app.activeDocument.pages);

        }

    catch(e){

        var sec = app.activeDocument.pages.appliedSection;

        }

    sec.continueNumbering = false;

    sec.pageNumberStart = parseInt(found);

    c++;

    }

function findMyTextStyle(myStyle

...

Votes

Translate

Translate
Advocate ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

Could you please explain more exactly what you want to achieve?

It would be best if you add snapshot.

Votes

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
Explorer ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

I have to make Cards wich contains a productnumber and a lot of different information on a product.

I want to change the pagenumber  in the "pages"-screen to that article number so that when i export to seperated pdf's i can put the article number in the filename.

*note that these numbers dont follow each other.

Votes

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
Advocate ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

Capture.JPGIf you want to change every page number, you can achieve this using number & section start section option defining each and every page individually.

You can choose each and every page number to fulfill your need.

Votes

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
Advocate ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

If still have doubts add snapshot

Votes

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
Explorer ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

true, but i have a lot of cards. so doing this manually is a lot of work, but this is what i try to automate.

Votes

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
People's Champ ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

Hi Bart,

I think what you're trying to achieve is clear. It needs a script, and I don't recall a free one that does this. So I recommend: (a) doing some Google-work to make sure it doesn't already exist; (b) Asking on the InDesign Scripting forum if you're interested in getting help with scripting this yourself, or (c) I'd be interested in working on this because it ties in with something else I'm doing. If interested, get in touch for a quote: admin [at] id-extras.com.

HTH,

Ariel

Votes

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
Community Expert ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

Tá´€W  wrote

Hi Bart,

I think what you're trying to achieve is clear. It needs a script, and I don't recall a free one that does this. …

Exactly.

FWIW: Adding sections, section naming or re-naming, even page naming will not help with the new InDesign feature for exporting every page as individual PDF file. Page names are not honored by the new export options.

A script doing this would pick up information on a page directly from a dedicated text frame ( just one out of more possible implementations ) and export exactly that page using the info for naming the files.

Regards,
Uwe

Votes

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
Advocate ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

You can try this below code,

var c = 0;

while(c < app.activeDocument.pages.length){

    var sec = app.activeDocument.sections.add(app.activeDocument.pages);

    sec.continueNumbering = false;

    sec.pageNumberStart = 1;

    c++;

    }

Votes

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
Explorer ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

Ok this makes every page start as a new section, but instead of making it all "1" it needs to be variable. It should be the number that's in a specific field or style on every page.

Feels like we're getting close

Votes

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
Community Expert ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

https://forums.adobe.com/people/Bart+Bossuyt+-+die+Keure  wrote

…

Feels like we're getting close

Unfortunately, not so much.

As I explained, InDesign's new export option for individual pages to PDF is not supporting page names.

Regards,
Uwe

Votes

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
Explorer ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

Actually Uwe, it is. ^p is actually doing what it should, so if i manually give the page that articlenumber then it will use that number in the filename. that works just fine, it's the manually renaming the page to section using the variable number that should be automated.

Votes

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
Advocate ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

You can use an array and store all the page number that is needed in ascending order,

and call it with index at number's place.

Votes

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
Explorer ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

problem is that the client doesn't use a particular order for the numbers (no idea why, but that's the way it is).

Votes

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
Advocate ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

No body can code for client's brain , only you can....

Votes

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
Community Expert ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

https://forums.adobe.com/people/Bart+Bossuyt+-+die+Keure  wrote

Actually Uwe, it is. ^p is actually doing what it should, …

Oops. Just checked that. You are right!

Thanks,
Uwe

Votes

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
Explorer ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

Hi Yada, is there a why you can change the script to do a lookup on the page to find a specific textstyle?

So instead of sec.pageNumberStart = 1 you lookup the style and change the "1" to the content that's marked with that style?

Votes

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
Advocate ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

Yes, you can do that,

    Try this,

var c = 0; 

var myStyle = "test";

while(c < app.activeDocument.pages.length){

    var found = findMyTextStyle(myStyle, app.activeDocument.pages);

    //If found then do//

    //else you can choose something else to do//

    //you can find character style instead of paragraph style//

    if(found==null){

        found = "1";

        }

    var sec = app.activeDocument.sections.add(app.activeDocument.pages);

    sec.continueNumbering = false; 

    sec.pageNumberStart = parseInt(found);

    c++; 

    } 

function findMyTextStyle(myStyle, myPage){

    var myStyleFound = null;

    app.findTextPreferences=app.changeTextPreferences=NothingEnum.nothing;

    try{

        // You can use paragraph Style Or character style, depending on your need------------------------

        app.findTextPreferences.appliedParagraphStyle = myStyle;

//~         app.findTextPreferences.appliedParagraphStyle = myStyle;

       

        var myFoundStyle = app.activeDocument.findText();

        app.findTextPreferences=app.changeTextPreferences= NothingEnum.nothing;

        app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;

        for(i = 0; i <myFoundStyle.length; i++){

            if(myFoundStyle.insertionPoints[0].paragraphs[0].parentTextFrames[0].parentPage.name.toString() == myPage.name.toString()){

                //You can do something here//

                //Or store your page number start here//

                //And return using variable//

                myStyleFound = myFoundStyle.contents.toString();

                }

            }

        }

    catch(e){}

    return myStyleFound;

    }

Votes

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
Advocate ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

Try this code, and if there are any error resolve it while starting number, you are almost there.

Votes

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
Advocate ,
Jul 03, 2018 Jul 03, 2018

Copy link to clipboard

Copied

Updated one.

var c = 0;    var myStyle = "test";

while(c < app.activeDocument.pages.length){

    var found = findMyTextStyle(myStyle, app.activeDocument.pages);

    if(found==null){

        found = "1";

        }

    try{

        var sec = app.activeDocument.sections.add(app.activeDocument.pages);

        }

    catch(e){

        var sec = app.activeDocument.pages.appliedSection;

        }

    sec.continueNumbering = false;

    sec.pageNumberStart = parseInt(found);

    c++;

    }

function findMyTextStyle(myStyle, myPage){

    var myStyleFound = null;

    app.findTextPreferences=app.changeTextPreferences=NothingEnum.nothing;

    try{

        app.findTextPreferences.appliedCharacterStyle = myStyle;

        var myFoundStyle = app.activeDocument.findText();

        app.findTextPreferences=app.changeTextPreferences= NothingEnum.nothing;

        app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;

        for(i = 0; i <myFoundStyle.length; i++){

            if(myFoundStyle.insertionPoints[0].paragraphs[0].parentTextFrames[0].parentPage.name.toString() == myPage.name.toString()){

                myStyleFound = myFoundStyle.contents.toString();

                }

            }

        }

    catch(e){}

    return myStyleFound;

    }

Votes

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
Community Expert ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

Votes

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
Explorer ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

Is there a way i can use a textstyle to mark the numbers? and then the pagenummer changes according to that specific Textstyle is some way?

i'm just thinking out loud here

Votes

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
Guide ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

Hmm! …

If I understand well, what you mean is to export each page to pdf naming it with a specific "article-number" placed on each page!

Right?

Best,

Michel, for FRIdNGE

Votes

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
Community Expert ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

That is my take as well Michel, which is why I offered exactly that solution in my post #10.

Votes

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
Guide ,
Jul 02, 2018 Jul 02, 2018

Copy link to clipboard

Copied

Hi Stephen,

Interesting article! … And thanks for the other articles I'll take time to read next WE! 

Personally, I'm more direct and, say, maybe less prosaic! …

Capture d’écran 2018-07-02 à 23.36.09.png

Based on Grep, the script exports to pdf each page with a found! Of course, the name of the pdf file will be, for this page:

ID-123456-789.pdf

Best,

Michel [not for-free script]

Votes

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