Skip to main content
Participant
July 28, 2017
Question

Select and OK Paragraph Style

  • July 28, 2017
  • 1 reply
  • 494 views

Hi,

I have a script I have been using for some time: https://indesignsecrets.com/topic/ignore-anchored-objects

It does the job well, but it would be great if it would automatically select a certain paragraph style and OK it without my intervention.

From what I can tell, the lines would fall at the end of the script after the creation of the dialog box and the call to list the paragraph styles.

I'm not a scripter, but if pointed in the right direction...

Thanks, Bob

This topic has been closed for replies.

1 reply

Inspiring
July 28, 2017

The function myGetParagraphStyleNames is only for the purpose of the dialog box so the user can choose the style she wants to use for the labels.

It sounds as if you want to use a specific paragraph style without having to choose it in the dialog. You can tell the dialog to choose a specific style as the default. You do this by setting the value of selectedIndex (which is currently set to 0--the first item in the list).

   var myLabelStyleDropdown = dropdowns.add({stringList:myStyleNames, selectedIndex:0});

For example, if you want the paragraph style  to be "Normal" and it is always the fourth one in the list, you could change the line to read:

   var myLabelStyleDropdown = dropdowns.add({stringList:myStyleNames, selectedIndex:3});

The problem is that, depending on the document, the list of paragraph styles will change ("Normal" will not always be the third one in the list).

You can be sure that the default paragraph style for the document will be the second item in the list, so you could use the value of 1 for selectedIndex.

Of course, you could eliminate the need for choosing the paragraph style, and just define the style as part of the script. But that's more than I think you want to deal with at this point. (1. Remove the choice from the dialog, and 2. specify the style by name.)

Hope this gets you started in the right direction.

Bob RubeyAuthor
Participant
July 29, 2017

S Hopkins

Since the paragraph style used will always be imported, dragging it to x position at the same time is doable. I don't know how much time I'd be saving at the end, but after I import the style I run four scripts from another script that batch processes them, so maybe a little.

Here's a Flash video (may need full screen for decent resolution) of the process; you will see where I'm trying to save a few seconds/steps: My expedited label image script procedure

The thought of doing away with the dialog altogether had crossed my mind too, but as you correctly state, more than I want to deal with.

Finally, how do I OK the edited dialog?

Looking forward to trying this on Monday. Thanks!