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

Script to add a page number marker

Explorer ,
Mar 22, 2023 Mar 22, 2023

Copy link to clipboard

Copied

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

Views

251

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

Community Expert , Mar 22, 2023 Mar 22, 2023

 

aTextFrame.contents = SpecialCharacters.autoPageNumber

 

 

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

 

Votes

Translate

Translate
Community Expert ,
Mar 22, 2023 Mar 22, 2023

Copy link to clipboard

Copied

 

aTextFrame.contents = SpecialCharacters.autoPageNumber

 

 

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

 

â–’â–º ID-Tasker / ID-Tasker Server - work smart not hard â—„â–’

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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 )

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

Copy link to clipboard

Copied

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!

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