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

Change Object Style when apply Autoflow

Participant ,
Aug 03, 2023 Aug 03, 2023

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

TOPICS
SDK
578
Translate
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 03, 2023 Aug 03, 2023

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.

Mike Witherell
Translate
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
Participant ,
Aug 22, 2023 Aug 22, 2023

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. 

Schermata 2023-08-22 alle 09.27.34.pngSchermata 2023-08-22 alle 09.26.05.png

Translate
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 03, 2023 Aug 03, 2023

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/

 

Translate
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
Participant ,
Aug 22, 2023 Aug 22, 2023

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.

Translate
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 22, 2023 Aug 22, 2023

You can set an object style as the default style for text and graphic frames in the Object Styles panel:

 

PeterKahrel_0-1692697551018.png

 

That way the style is applied to all new frames.

Translate
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
Participant ,
Aug 23, 2023 Aug 23, 2023

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.

Translate
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
Mentor ,
Aug 25, 2023 Aug 25, 2023
LATEST

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.

Translate
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