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

Script to add a page number marker

Explorer ,
Mar 22, 2023 Mar 22, 2023

Hi all,

I'm trying to add folios to currently unnumbered pages using a pretty simple script like:

app.activeDocument.masterSpreads.item("A-Parent").textFrames.add({
    geometricBounds: ["62", "40", "63", "47"],
    contents: "?",
    itemLayer: "Layer 1",
    parentStory: {appliedParagraphStyle: ""}
})

This creates the box just fine, but I have no idea what to use for the "contents: "?" to insert a current page number marker. I'm not even sure how to look this up. Is it even possible?

 

Thanks for any help!

-Don

TOPICS
Scripting
617
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 1 Correct answer

LEGEND , Mar 22, 2023 Mar 22, 2023

 

aTextFrame.contents = SpecialCharacters.autoPageNumber

 

 

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#SpecialCharacters.html

 

Translate
LEGEND ,
Mar 22, 2023 Mar 22, 2023

 

aTextFrame.contents = SpecialCharacters.autoPageNumber

 

 

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#SpecialCharacters.html

 

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
Explorer ,
Mar 22, 2023 Mar 22, 2023

Yes! And now that I know what to look for, I know how to find them in the API. Thank you!

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 Expert ,
Mar 22, 2023 Mar 22, 2023

Hi @dona56558947 ,

see a list of special character enumerators at the InDesign DOM documentation compiled by Gregor Fellenz:

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#SpecialCharacters.html

 

So this is working:

contents : SpecialCharacters.AUTO_PAGE_NUMBER ,

 

Hm. What do you like to do with:

 parentStory: { appliedParagraphStyle : "" }

If you want to apply the "no paragraph style" style do this:

 parentStory: { appliedParagraphStyle : app.documents[0].paragraphStyles[0] }

 

Regards,
Uwe Laubender
( Adobe Community Expert )

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
Explorer ,
Mar 22, 2023 Mar 22, 2023
LATEST

I was still working on the styling part. Since there are no folios in these docs currently, there is no paragraph style to apply. I've now added another step to first create a "Folio" paragraph style and properly style these new folios. 

Thanks!

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