Copy link to clipboard
Copied
Hi everyone,
I'm using autoflow function of InDesign(click [+] of textFrame in overset and shift+click in a point of document), but I noticed that all the new boxes it creates have [None] like Object style applied, if I wanted that when creating these new boxes, it already apply a certain object style created by me, how should I do?
Obviously i wanted to know how to do that programmatically, but if somone know how to do that through interface would still help me.
Stefano
Copy link to clipboard
Copied
Maybe you could pre-build the textframes on the parent page, and apply the Object style on the parent page. That way when placing Word Docx files, the Object style will be applied.
Copy link to clipboard
Copied
Thank you for your answer @Mike Witherell,
I already tried this method but unfortunately it doesn't work because the method I use for the overflow seems to create new boxes with no style applied, even though the parent has a certain style applied, maybe i leave a photo of the method i use.
i also tried to set default style and default text style to object style that i want to apply to box, but nothing to do it doesn't work.
Copy link to clipboard
Copied
Here's a trick you might play with: It provides a way to apply an object style to text frames in a text thread. It goes all the way back to 2007 but I tested it and it still works for some (but not all) applications.
https://creativepro.com/applying-object-styles-to-all-the-frames-in-a-text-thread/
Copy link to clipboard
Copied
Thank you for your answer @Steve Werner,
actually as a manual method it is very effective, but I'm looking for a way that when the new boxes are created they already have the correct style applied, because I noticed that applying it after the overflow creates some overset problems, for example, if the style to be applied contains more columns the text will inevitably get longer, because gutter is added.
Copy link to clipboard
Copied
You can set an object style as the default style for text and graphic frames in the Object Styles panel:
That way the style is applied to all new frames.
Copy link to clipboard
Copied
Thank you @Peter Kahrel for your reply,
This method seems works manually,thanks for the advice, now i have to recreate it programmatically.
I've created another post about it: How to change the default Object Style.
Copy link to clipboard
Copied
Just looking around from the other thread. As you mention below, this appears to be your original reason for changing the default style - and I think you should not. While modifying the default seems to be the only way from the scripting side, true plug-ins have a far richer choice of notifications to watch for arbitrary changes. You'd first have to learn how to use them, then also identify the one relevant to your purpose. Again (as with the unknown interfaces in the other thread) there is no silver bullet, but this time I'd recommend to search mentioned keywords in the programming guide and example projects.
Before you launch that autoflow, you can attach an own observer to the kDocBoss of your document, better also detach it when finished. The observer would be for the protocol IID_IOBJECTSTYLEINFO, changedBy kApplyObjectStyleCmdBoss, and the void* is the very kApplyObjectStyleCmdBoss. This is a general way to watch when the command applies an object style to any object in the document, including by the user or yourself when changing it to something else. So make sure you don't interfere in those other cases. I have not tried the special case when the default style is set to no-style, likely the command would be omitted in that case.
An alternative to observers is signal/responder. Search the SDK for responders in general, you will need the service ID kNewPISignalResponderService and have a look at kNewPISignalMgrBoss. Since a responder is permanently installed, you need more logic to filter for your Autoflow use case.
Also make sure that you're handling the correct page item, for plug-ins there are far more than for scripting. You want to deal with the kSplineItemBoss and ignore others such as kMultiColumnItemBoss, kFrameItemBoss.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now