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

Element labels in scripting

Community Beginner ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

I'm afraid my question will betray my ignorance, but can anyone help me use these 'element labels' (I think that's what they're called) in a script?

Scherm­afbeelding 2023-10-18 om 17.10.06.pngScherm­afbeelding 2023-10-18 om 17.45.03.png

There are a number of text frames (or stories?) in the document, each with one of various labels. I want to collect elements with the same label and use their contents in a script. Unfortunately, I can't find a way to access those labels. I've tried collecting all textFrames, stories, pageItems... and then using ".label", but I don't get the expected results.

Can anyone help?

TOPICS
Scripting

Views

411

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 2 Correct answers

Community Beginner , Oct 18, 2023 Oct 18, 2023

Thanks everyone for pointing me in the right direction so quickly. You're right, element labels are added by Woodwing and are mentioned in their dedicated scripting guide!

Votes

Translate

Translate
Community Beginner , Oct 25, 2023 Oct 25, 2023

Here is a sample how to handle pageItems with an elementLabel in WoodWing

for (var p=0; p<curPageItems.length; p++) {
var curPageItem = curPageItems[p];
if ( curPageItem.hasOwnProperty(„elementLabel“) ) {
$.writeln(„PageItem: „ + curPageItem.constructor.name + „ | ElementLabel: „ + curPageItem.elementLabel);
}
}

Votes

Translate

Translate
People's Champ ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

It looks like you're using the Woodwing Studio plugin?

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 ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

quote

It looks like you're using the Woodwing Studio plugin?


By @Tá´€W

 

You are right - 2nd screenshot:

 

https://helpcenter.woodwing.com/hc/en-us/articles/360041448831-Components-that-are-added-to-InDesign... 

 

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 Beginner ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

Yes, those labels are related to Woodwing Studio. Is that why I can't access them through scripting?

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 ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

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 Beginner ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

I assumed those labels were a standard InDesign feature leveraged by Woodwing, but if they don't look familiar to anyone here, that's what I'll do. 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
Community Expert ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

Sometimes REAL plugins can add extra functionality - and also offer extra scripting options.

 

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
People's Champ ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

In my limited experience of this plugin, Woodwing studio gets deep into InDesign's standard scripting DOM. It actually removes some properties (for instance, stories no longer have a "locked" property, and they cannot be exported to .icml), and adds a whole bunch of others.

So you would need to look at WW's scripting documentation (or use the DOM browser that comes with ESTK, because that reflects the changes that happen to the DOM when WW Studio is installed) to see what properties and methods you have available.

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 Beginner ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

Thanks everyone for pointing me in the right direction so quickly. You're right, element labels are added by Woodwing and are mentioned in their dedicated scripting guide!

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 ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

Hi @Robrecht5C72 , Is the Woodwing plugin setting the document’s XML structure—View>Show Structure? If it is you could access the XML elements via JS.

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 Beginner ,
Oct 18, 2023 Oct 18, 2023

Copy link to clipboard

Copied

That could be an interesting approach! I'll check.

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 Beginner ,
Oct 25, 2023 Oct 25, 2023

Copy link to clipboard

Copied

LATEST

Here is a sample how to handle pageItems with an elementLabel in WoodWing

for (var p=0; p<curPageItems.length; p++) {
var curPageItem = curPageItems[p];
if ( curPageItem.hasOwnProperty(„elementLabel“) ) {
$.writeln(„PageItem: „ + curPageItem.constructor.name + „ | ElementLabel: „ + curPageItem.elementLabel);
}
}

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