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

Help with Script to auto tag a folder of paragraph styles

Contributor ,
Aug 05, 2020 Aug 05, 2020

Copy link to clipboard

Copied

I'm trying to create a script to auto tag my paragraph styles.

I know how to call out specific styles and tag them with a specific tag (H, P, etc.) and even 'all others' with a different tag. 

Is there a way to call out all of the styles in a specific folder?

With some changes that InDesign has made, list styles need to be tagged with [Automatic] ... How would i script to tag all files in 'Lists' folder to [Automatic]

 

thank you!

TOPICS
Scripting

Views

314

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 , Aug 05, 2020 Aug 05, 2020

My bad, had only tested with ePub, not PDF. 

 

Just remove all existing style maps instead: 

 

var autoGroup = app.documents[0].paragraphStyleGroups.itemByName("Lists");
var styleTags = autoGroup.paragraphStyles.everyItem().styleExportTagMaps.everyItem().remove();

 

Votes

Translate

Translate
Community Expert ,
Aug 05, 2020 Aug 05, 2020

Copy link to clipboard

Copied

You want the ParagraphStylesGroup object. So:

 

var autoGroup = app.documents[0].paragraphStyleGroups.itemByName("Lists");
autoGroup.paragraphStyles.everyItem().styleExportTagMaps.everyItem().exportTag = "[Automatic]";

 

 

 

 

 

 

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
Contributor ,
Aug 05, 2020 Aug 05, 2020

Copy link to clipboard

Copied

I recieved an error "Invalid tag for style mapping"

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 ,
Aug 05, 2020 Aug 05, 2020

Copy link to clipboard

Copied

My bad, had only tested with ePub, not PDF. 

 

Just remove all existing style maps instead: 

 

var autoGroup = app.documents[0].paragraphStyleGroups.itemByName("Lists");
var styleTags = autoGroup.paragraphStyles.everyItem().styleExportTagMaps.everyItem().remove();

 

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
Contributor ,
Aug 06, 2020 Aug 06, 2020

Copy link to clipboard

Copied

LATEST

perfect! 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