Skip to main content
Participant
October 10, 2018
Answered

Two-sided card numbering

  • October 10, 2018
  • 2 replies
  • 2445 views

Hi hi

I have an Indesign file of 800 two sided cards (1600 pages) and I want to add numbers to the cards from both sides.

Anyone knows how I can add automatic numbering in the following role:

Pages 1 and 2 will both be numberd #1 , pages 3 and 4 will be numberd #2, and so on.. ??

Please help it will save me so much work

This topic has been closed for replies.
Correct answer FRIdNGE

Hi,

As Rob, I truly prefer simplicity!

[Personal comment removed! ...]

My script uses 2 object styles that can, since CC 2018, manage size & location.

It presents 2 parts:

• removing of all the old text frames (if already in the doc), using the 2 previous OS,

• adding of new text frames with insertion of the numbering.

Note the numbering is defined by an user-counter and not directly by the page number or index.

Of course, a global undo!

Best,

Michel, for FRIdNGE

// by FRIdNGE, october 2018

// WARNING: The user needs to previously create the 2 Object Styles ("Right"/"Left")!

app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "Numbering! …");

function main()     

    {

        var myDoc = app.activeDocument,

        myPages = myDoc.pages,  P = myPages.length,  p,

        myObjStyleRight = myDoc.objectStyles.item("Right"),  myObjStyleLeft = myDoc.objectStyles.item("Left"),

        //////////////////

        myCounter = 1;

        //////////////////

        // Remove Old Num Text Frames

        app.findObjectPreferences = null;

        app.findObjectPreferences.appliedObjectStyles = myObjStyleRight;

        myFound = app.findObject();

        var F = myFound.length,  f ;

        for ( f = 0; f < F ; f++ ) myFound.remove();

        app.findObjectPreferences.appliedObjectStyles = myObjStyleLeft;

        myFound = app.findObject();

        var F = myFound.length,  f ;

        for ( f = 0; f < F ; f++ ) myFound.remove();

        app.findObjectPreferences = null;

        // Add New Num Text Frames

        for ( p = 0; p < P ; p++) {

            var myTFrame = myPages

.textFrames.add();

            myTFrame.contents = String(myCounter);

            if ( p%2 == 0 ) myTFrame.applyObjectStyle(myObjStyleRight);

            else {

                myTFrame.applyObjectStyle(myObjStyleLeft);

                myCounter++

            }

        }

    }

2 replies

rob day
Community Expert
Community Expert
October 10, 2018

Anyone knows how I can add automatic numbering in the following role:

A simple script could set up page sections for every page with the appropriate start numbering. This is AppleScript (OSX only)

--makes every page a section

tell application "Adobe InDesign CC 2018"

    tell active document

        set p to every page

        repeat with i from 1 to count of p

            if i mod 2 is 0 then

                set itm to item i of p

                set previtm to item (i - 1) of p

                set pnum to i / 2 as integer

                try

                    make new section with properties {page start:previtm, page number start:pnum}

                    make new section with properties {page start:itm, page number start:pnum}

                end try

            end if

        end repeat

    end tell

end tell

Here are non facing pages with a Current Page Number on the master

FRIdNGE
FRIdNGECorrect answer
October 10, 2018

Hi,

As Rob, I truly prefer simplicity!

[Personal comment removed! ...]

My script uses 2 object styles that can, since CC 2018, manage size & location.

It presents 2 parts:

• removing of all the old text frames (if already in the doc), using the 2 previous OS,

• adding of new text frames with insertion of the numbering.

Note the numbering is defined by an user-counter and not directly by the page number or index.

Of course, a global undo!

Best,

Michel, for FRIdNGE

// by FRIdNGE, october 2018

// WARNING: The user needs to previously create the 2 Object Styles ("Right"/"Left")!

app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "Numbering! …");

function main()     

    {

        var myDoc = app.activeDocument,

        myPages = myDoc.pages,  P = myPages.length,  p,

        myObjStyleRight = myDoc.objectStyles.item("Right"),  myObjStyleLeft = myDoc.objectStyles.item("Left"),

        //////////////////

        myCounter = 1;

        //////////////////

        // Remove Old Num Text Frames

        app.findObjectPreferences = null;

        app.findObjectPreferences.appliedObjectStyles = myObjStyleRight;

        myFound = app.findObject();

        var F = myFound.length,  f ;

        for ( f = 0; f < F ; f++ ) myFound.remove();

        app.findObjectPreferences.appliedObjectStyles = myObjStyleLeft;

        myFound = app.findObject();

        var F = myFound.length,  f ;

        for ( f = 0; f < F ; f++ ) myFound.remove();

        app.findObjectPreferences = null;

        // Add New Num Text Frames

        for ( p = 0; p < P ; p++) {

            var myTFrame = myPages

.textFrames.add();

            myTFrame.contents = String(myCounter);

            if ( p%2 == 0 ) myTFrame.applyObjectStyle(myObjStyleRight);

            else {

                myTFrame.applyObjectStyle(myObjStyleLeft);

                myCounter++

            }

        }

    }

cinziamarotta
Participating Frequently
October 10, 2018

Hi,

you need an InDesign script. Post the question on InDesign scripting forum

Participant
October 10, 2018

OK thank you! I'll do that

vladan saveljic
Inspiring
October 10, 2018

...or you could make a numbered list in excel and import it in indesign