Skip to main content
gabrielg28279016
Participating Frequently
September 16, 2019
Question

Can I label a paragraph or ParagraphStyle using script?

  • September 16, 2019
  • 4 replies
  • 978 views

I have a script that takes docx files and pdfs and sets up a journal. I need to be able to label the documents when inserting them so that at the end of the inserts I can identify the page where the paragraph/file is.

This topic has been closed for replies.

4 replies

Legend
September 23, 2019

You could use the XML features for structuring.

https://helpx.adobe.com/indesign/using/xml.html

 

Community Expert
September 23, 2019

Hi sreekarthikeyank,

as I already said before: You cannot add a label to text.

That includes all kinds of text. Also paragraphs.

 

Regards,
Uwe Laubender

( ACP )

Community Expert
September 18, 2019

Hi Gabriel,

do you mean the ExtendScript methods insertLabel("key string", "value string") and extractLabel("key string") ?

Then the answer will be: No, text like characters, words or paragraphs cannot be labeled with that.

ParagraphStyles can be labeled. Graphic frames can be labeled. Even links can be labeled.

 

What you can do with text is you can index text.

But I don't know if that will help much.

 

Or you could apply character styles that have no visual effect if you do not applied character style for formatting reasons.

Or you could apply a unique property, a text formatting that is otherwise invisible* and that you could search for with Text Find/Change or GREP Find/Change and loop the results for the parentTextFrames array and look into the value of parentPage of all items of that array.

 

*perhaps underlineTint if there is no underline in the text.

 

Hm. You also could add Note objects.

But you cannot do this with footnotes.

 

Regards,

Uwe Laubender
( ACP )

sreekarthikeyank
Known Participant
September 23, 2019
I needs to add unique string value for each and every paragraphs. Can you please suggest me the supporting property.
Community Expert
September 17, 2019

You can create a Table of Contents that includes the relevant Paragraph Style.

When you generate the TOC check Create PDF Bookmarks. Place the generated text on the pasteboard. You can now use the Bookmarks panel to navigate to the page(s) that contains the text in the relevant style.

gabrielg28279016
Participating Frequently
September 17, 2019
I can do it all via script, correct? I couldn't search very well, as almost all forum topics talking about it disappeared after the update.