Copy link to clipboard
Copied
Hi!
I need to find all inline elements with a object style applied on it go to the paragraph where they are placed and apply a different paragraph style. See the images for examples.
Here the object style applied:
I want to find them, go to their paragraph:
And apply other paragraph style (one with spaces before and after):
Is this possible with a script? I'm sending the indesign files too!
Please help me.
Try the following code
app.findObjectPreferences.appliedObjectStyles = "box"
var r = app.activeDocument.findObject()
for(var i = 0; i < r.length; i++)
{
if(r[i].parent.constructor.name == "Character")
r[i].parent.appliedParagraphStyle = "space"
}
app.findObjectPreferences.appliedObjectStyles = null
-Manan
Copy link to clipboard
Copied
Try the following code
app.findObjectPreferences.appliedObjectStyles = "box"
var r = app.activeDocument.findObject()
for(var i = 0; i < r.length; i++)
{
if(r[i].parent.constructor.name == "Character")
r[i].parent.appliedParagraphStyle = "space"
}
app.findObjectPreferences.appliedObjectStyles = null
-Manan
Copy link to clipboard
Copied
Thank you! It works!
Nice to know about that parent.constructor thing!
Copy link to clipboard
Copied
Instead the box you could do a paragraph style as in my example below. Than you can easily find all these paragraphs and apply different paragraph styles.
Copy link to clipboard
Copied
Hi vladan!
My file is only a example file. I really want to apply paragraph style to these inline objects, because this will make easy a export HTML thing that I'm work in. But thank you for your answer!