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

Script to display InDesign Page Size instead of Document Setup size

Explorer ,
Sep 02, 2014 Sep 02, 2014

Hello, I was very kindly helped out with the below script (using a text variable) which displays the size of the current page within an InDesign document.

The result it gives is based on the Document Setup, and I was wondering if it was possible to amend it to base the result on the Page Size instead (as you can now change the page size independently of the Document Setup within InDesign using the Page Tool). I don't know anything about scripting by the way!

Many thanks in advance for any help.

var doc = app.activeDocument; 

doc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.millimeters; 

doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.millimeters; 

var w = doc.documentPreferences.pageWidth, 

    h = doc.documentPreferences.pageHeight, 

    pagesize = app.activeDocument.textVariables.itemByName("PageSize"); 

pagesize.variableOptions.contents = h + " mm X " + w + " mm"; 

TOPICS
Scripting
8.1K
Translate
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 2 Correct answers

Enthusiast , Sep 02, 2014 Sep 02, 2014

Try this,

var doc = app.activeDocument;

doc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.millimeters;

doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.millimeters;

for(var i =0;i<doc.pages.length;i++)

{

        alert("Page Width : " +  doc.pages.bounds[3] + "\rPage Height : " + doc.pages.bounds[2] )

    }

Regards,

Chinna

Translate
LEGEND , Jul 06, 2024 Jul 06, 2024

@Lital5E82 

 

Forgot to mention - thanks to the ObjectStyle - you can set your own properties, including ParaStyle to format text.

 

Translate
LEGEND ,
Jul 06, 2024 Jul 06, 2024

@Lital5E82 

 

Forgot to mention - thanks to the ObjectStyle - you can set your own properties, including ParaStyle to format text.

 

Translate
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 Beginner ,
Jul 06, 2024 Jul 06, 2024
LATEST

wowwwww

thats perfect

thank you very much

you helped me so much

Translate
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