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?
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?
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!
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);
}
}
Copy link to clipboard
Copied
It looks like you're using the Woodwing Studio plugin?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Yes, those labels are related to Woodwing Studio. Is that why I can't access them through scripting?
Copy link to clipboard
Copied
You should rather contact Woodwing directly?
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!
Copy link to clipboard
Copied
Sometimes REAL plugins can add extra functionality - and also offer extra scripting options.
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.
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!
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.
Copy link to clipboard
Copied
That could be an interesting approach! I'll check.
Copy link to clipboard
Copied
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);
}
}