Applying object style via scripting have always '+' sign besides it

Explorer ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

Hi all!

I have that problem in all the text frames when I try to apply a object style via scripting. This is a example of the code:

            marco = crear_marco(-1, 'CAL_DIAS', dimensiones[0]);
            marco.contents = año_completo[mes - 1].nombre; // mes anterior
            marco.insertionPoints.item(0).appliedParagraphStyle = doc.paragraphStyles.item('CAL_PEQ_nombre mes');
            marco.words.everyItem.appliedCharacterStyle = doc.characterStyles[0]; 
            marco.applyObjectStyle(doc.objectStyles.item('CAL_PEQ_nombre mes'), true, true);

marco is a text frame (one of the 36 in the doc created this way) returned by crear_marco() function. I have dived into the forum and I have found the use of (true, true) after object style name in order to override all that can be overrided.

But the style must center the text in the frame, and it isn't. The style in the panel have the damned '+' sign beside it. If I use mouse's rigth button and apply the overrides manually, it works.

What I'm doing wrong?

Any help will be welcome.

PD: sorry for my english, it's not so good like I wish...

TOPICS
Scripting

Views

81

Likes

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 1 Correct Answer

Adobe Community Professional , Mar 18, 2021 Mar 18, 2021
Hi Mammon_2, could you show some screenshots of the issue? Before running the script, after running the script. What will happen if you change the values for the second and third argument of the method applyObjectStyle() ? Did you test that with all possible values? true, true true, false false, true false, false What's your version of InDesign? What's your operating system? Are you able to apply the object style using the graphical user interface so that your result has no overrides? ...

Likes

Translate

Translate
Adobe Community Professional ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

Hi Mammon_2,

could you show some screenshots of the issue?

Before running the script, after running the script.

 

What will happen if you change the values for the second and third argument of the method applyObjectStyle() ?

Did you test that with all possible values?

 

true, true

true, false

false, true

false, false

 

What's your version of InDesign?
What's your operating system?

 

Are you able to apply the object style using the graphical user interface so that your result has no overrides?

 

Regards,

Uwe Laubender

( ACP )

Likes

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
Explorer ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

LATEST

Hi Uwe!

Upppps, I think I missed a lot of info, isn't it?

1. Before the script... was the design pattern.

plantilla.jpg

 And after the script... was the all!

resultado.jpg

 Basically, I give to Indesign the placeholders that I want to replace with desided elements. Every text frame in the pattern contents the code of an element (M for the name of month, D5 for the days of month in 5 rows - D1 for 1 row, D6 for 6 rows-, MAM for name of previous month and so on). The script recopiles the info of each placeholder (code, size and position), holidays, special events, moon phases, colors, etc and creates a full calendar (1 page, 12 pages or 12 calendar pages + 12 picture pages + 1 cover).

2. I tried minutes ago. Nothing works.

 

3. Indesign 2021 - 16.1. Tried 2020, 2019... and I have the same behaviour (I have been working in this script for some years, adding functionalities and improving it. That's the V 7.5)

 

4. Windows 10 64 bits, updated to the last version.

 

5. Aaaaaand... we have a WINNER! I tried to apply the style from GUI, like you advise me. Hmmmm the damned + remains... What if I apply first [None] and then my style? DING DING DING! GOTCHA!

So I add one line applying the style [None] before the one that apply my style, and now it works (sorry, editor tell me that there's and error in the code pasted...)

 
Which shows that you just have to ask the right questions to solve a problem, and you do it.
Thanks Uwe!!
If you see another answer now that you have all the info, I'll thank you.
 
Best regards from Spain,
Jose

Likes

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