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

Number pages 001, 002

LEGEND ,
Sep 24, 2016 Sep 24, 2016

Copy link to clipboard

Copied

Hi,

I can't find the [JS] syntax to number the pages of a document: 001, 002, 003, …!  Annoying! 

Thanks for your help!

(^/)

TOPICS
Scripting

Views

595

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
LEGEND ,
Sep 24, 2016 Sep 24, 2016

Copy link to clipboard

Copied

I did it like this:

            var myNumbering = allPages.name;

            myNewNumbering = ("00" + myNumbering).slice(-3);

What I really wanted was , having n pages, export them to eps and have a numbering with 3 numbers!

So, 1 ==> 001, 2 ==> 002, … 58 ==> 058, … 112 ==> 112!

(^/)

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 ,
Sep 24, 2016 Sep 24, 2016

Copy link to clipboard

Copied

Hi,

It is under sectionPrefix.. we need to give "00" until 99.. use for loop..

aDoc = app.activeDocument;

aDoc.sections.everyItem().sectionPrefix = "0";

aDoc.sections.everyItem().includeSectionPrefix = true;

useful thread

JS Check if a page has section prefix set

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 ,
Sep 24, 2016 Sep 24, 2016

Copy link to clipboard

Copied

try this:

var main = function () {

  var d = app.properties.activeDocument,

  ps, p, n, epsFile, pn;

  var zeros = "000";

  if ( !d ) return;

  ps = d.pages;

  n = ps.length;

  while (n--) {

  p = ps;

  pn = p.name;

  epsFile=  File ( Folder.desktop+"/"+zeros.slice(0, -pn.length )+pn +".eps" );

  app.epsExportPreferences.pageRange = pn;

  d.exportFile ( ExportFormat.EPS_TYPE, epsFile );

  }

}

main();

HTH

Loic

Ozalto | Productivity Oriented - Loïc Aigon

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
Advisor ,
Sep 25, 2016 Sep 25, 2016

Copy link to clipboard

Copied

LATEST

InDesign ExtendScript API (10.0)

Section.pageNumberStyle=PageNumberStyle.DOUBLE_LEADING_ZEROS

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