Skip to main content
Inspiring
October 28, 2022
Question

Preventing ParaStyle "Based On" from Updating

  • October 28, 2022
  • 3 replies
  • 1074 views

Hi. I'm trying to stop InDesign from updating styles that are based on other styles while a Javascript is running, but I have no idea how (or even if it can be done).

 

I need to increase the point size of a couple hundred paragraph styles in one document and have written a Javascript that successfully does so. However, the problem I'm running into is that when Style A is updated, it's point size is changed to the same point size of Style B, the paragraph style on which Style A is based. When the Javascript goes on to update Style B, that change populates down to Style A because they no longer differ. Here's a specific case to clarify.

 

Style TX is 10 point.

Style BI is based on style TX but is point 9 point instead of 10.

Javascript changes BI to 10 point, thus effacing the 9-point/10-point discrepancy.

Javascript changes TX to 11 point.

Because BI is based on TX and because their point sizes no longer differ, InDesign changes BI to 11 also.

 

I need to prevent that last step. Does anyone know if it's possible to prevent InDesign from populating changes in a style to other styles that are based upon it?

 

Thanks for any help. 

This topic has been closed for replies.

3 replies

Peter Spier
Community Expert
Community Expert
October 31, 2022

Hoiw about changing the order in which you update the styles in the script? Chqange the base style first, then the ones based on it.

Robert at ID-Tasker
Legend
October 31, 2022

Yeah, already suggested - but in JS it would be a bit complicated. 

Peter Spier
Community Expert
Community Expert
November 1, 2022

sorry, I missed that.

Community Expert
October 29, 2022

Hi @Matthew Williams CMH ,

I see the option to work not with full point sizes.

Instead of doing changes from 9 Pt. to 10 Pt., do a change to 10.001 perhaps.

Use a unique value for every change like 10.001, 10.002 and so on.

Visibly there is no difference to 10 Pt.

 

Just an idea, did no tests for this.

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Robert at ID-Tasker
Legend
October 29, 2022

I've already suggested that... 

Community Expert
October 29, 2022

Yes. But the difference in point sizes should be much more lower.

You'll see a difference in text composition when you work with e.g. 10.1 Pt instead of 10.0.

Not so much or not at all when you work with more subtle values like 10.001 instead of 10.0.

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Robert at ID-Tasker
Legend
October 28, 2022

The whole idea of "based on" is to auto-update changes 😉

 

You have pretty much have 2 options:

 

  1.  Unlink temporarily - set Based On for a child to nothing 
  2.  Change your workflow - process in reverse order - best would be to create a tree of parent -> child and process from the last child up

 

Or maybe 3rd option - don't set whole numbers but 9.1 and then go again and remove ".1"? To be on a safe side - do ".1" as a counter - ".01", ".02"... so you won't have to check Based On. 

 

But I think going from childrens to parents would be the best option. 

Inspiring
October 28, 2022

Thanks for your thoughts!

 

Yeah, I understand the purpose of "based on"; that's why I used it when I built the templates, which are incredibly complex. The options you suggest had occurred to me, but I'm hoping there's an easier way. Re: 1, the only way I can think to unlink and then relink the based-ons is to build an array to store the based-on values for all 238 styles. If I'm going to go to that trouble, I might as well just create an array of point sizes and then drop those into the style definitions. (I'd have to start with the parents, though, and work down through the chains; if I change the children first, I'll end up with the same problem I have in the BI/TX example above. Re: 2, this would be incredibly unwiedly, unfortunately. Some of the styles have based-on chains two or more levels deep.

 

At some point, InDesign has to say to itself, "Aah. The point size for TX changed, so I need to change the point size for everything based on it that shares the same point size." If I can suspend that action until after the script is finished, the whole problem goes away.

 

Sounds, though, like that's too low of a level in the code to access. Sigh. I may just have to do it manually. At least I got some experience writing a Javascript.

Robert at ID-Tasker
Legend
October 29, 2022

Yeah, option 2. would be probably quite complicated in JavaScript - but it's extremely simple in VB6.

So you are left with an array of 238 Based On values or point sizes option.

 

But let's go back to the basics 😉 what is your goal? What are you trying to achieve?