6 Replies Latest reply on Sep 15, 2014 11:34 AM by kapoor_aman27

    I want to open "Paragraph Style Options" dialogue using Script(jsx)

    kapoor_aman27 Level 1

      Hi,

       

      I have created a paragraph style using JSX.

       

      var myDocument = app.activeDocument;

      var myParagraphStyle = myDocument.paragraphStyles.item("myParagraphStyle");

       

      Now I want to edit my paragraph style using the "Paragraph Style Options" window. How can I open the window for myParagraphStyle using JSX?

      Is there any way to do it? I don't want to manually double click the name in the list to open it.

        • 1. Re: I want to open "Paragraph Style Options" dialogue using Script(jsx)
          Laubender Adobe Community Professional & MVP

          @kapoor_aman27 – with a little trick we could select a distinct paragraph style in the Paragraphs Style panel.

           

          Add a new text frame to the document, add some contents, one character is sufficient. Format its contents with your paragraph style. Set the Paragraph Styles panel to visible. Select the text in the text frame with something like that: app.select(myTextFrame.texts[0]). Remove the text frame; the paragraph style stays selected in the panel.

           

          The next step would be to invoke the "Paragraph Style Options" panel. The id for the appropriate scriptMenuAction is 8481.

           

          try{
          app.scriptMenuActions.itemByID(8481).invoke();
          }catch(e){$.writeln(e.message)};
          

           

          But unfortunately this would throw an error. Something like this:

           

          (Error message in German:)

           

          "Mit der angeforderten Aktion wurde ein asynchrones, modales Dialogfeld geöffnet,

          für das eine Vorschau erstellt werden kann.

          Dies ist nicht mit der Skriptarchitektur kompatibel, daher wurde das Dialogfeld

          mit der Standardschaltfläche automatisch verworfen."

           

          (Roughly translated to English:)

           

          "An asynchronous, modal dialog box was opened by this action.

          A preview can be created with that dialog box.

          This is not compatible with the scripting architecture, therefore the dialog box

          with the standard button was automatically rejected."

           

          So I see no chance to do what you want.

           

          (Tested with inDesign CS5.5 on Mac OSX 10.6.8)

           

          Don't know, if that behavior has changed for more recent versions of inDesign…

           

          Uwe

          • 2. Re: I want to open "Paragraph Style Options" dialogue using Script(jsx)
            kapoor_aman27 Level 1

            Hi Laubender, thanks for the info.

             

            but I want to edit my style without applying it to any text. Is there a way I can directly open the panel for my style ? I have the style name with me.

            • 3. Re: Re: I want to open "Paragraph Style Options" dialogue using Script(jsx)
              Laubender Adobe Community Professional & MVP

              Without applying it to the text?
              That's not possible, if you want to use the "Options" panel in the graphical user interface of InDesign.

               

              You could open the Paragraph Styles Panel by making it visible. But then you cannot select a distinct style without selecting something before. Therefore this trick in my last post.

               

              How to make it visible:

               

              app.panels.itemByName("$ID/kParaStyles").visible = true;
              

               

              But then opening the "Options panel" seems not possible at all. So, you are out of luck here.

               

              Of course you could change any property of your paragraph style by assigning new values by scripting directly:

               

              app.documents[0].paragraphStyles.itemByName("MyParaStyleName").properties =
                  {
                      pointSize : 18 ,
                      horizontalScale : 150
                      //etc.pp.
                  };
              

               

              But your question in your first post suggested a different direction…

               

              Uwe

              • 4. Re: Re: Re: I want to open "Paragraph Style Options" dialogue using Script(jsx)
                kapoor_aman27 Level 1

                Hi Laubender,

                 

                I am able to open the the paragraph style panel using below command:

                app.scriptMenuActions.itemByID(8450).invoke()  //opens paragraph styles panel
                

                 

                and after that when I fire the next command, it opens the paragraph style options panel for the selected paragraph style.

                app.scriptMenuActions.itemByID(8463).invoke()  //opens paragraph styles Options panel
                

                 

                is there a way I can change the selection in paragraph style panel before opening the paragraph style options panel ??

                Or even better if there is a way to open paragraph style options panel for "myStyle" without opening the paragraph style panel

                • 5. Re: Re: Re: Re: I want to open "Paragraph Style Options" dialogue using Script(jsx)
                  Laubender Adobe Community Professional & MVP

                  Thank you for providing the ID number 8463 .

                  But I get an error. Same like shown in answer #1 in this thread.

                   

                  I tested on Mac OSX 10.6.8 with InDesign CS5.5. What is your version? What is your OS? Windows? Maybe that's a difference…

                   

                  I already did a prescription for selecting the wanted paragraph style in the paragrapg styles panel.

                  If we have a paragraph style named "myParaStyle" (not nested in a style group) we can do it like that:

                   

                  var myDoc = app.documents[0];
                  
                  var myParaStyleToSelect = myDoc.paragraphStyles.itemByName("myParaStyle");
                  
                  var myTempTextFrame = myDoc.textFrames.add({contents:"dummy text"});
                  myTempTextFrame.texts[0].appliedParagraphStyle = myParaStyleToSelect;
                  
                  //Necessary, because the paragraph styles panel will react to it:
                  app.select(myTempTextFrame.texts[0]);
                  
                  //Make the panel visible is better than invoking the panel with a script menu action:
                  app.panels.itemByName("$ID/kParaStyles").visible = true;
                  
                  
                  //THIS IS THROWING AN ERROR WITH MY INDESIGN:
                  
                  try{
                  app.scriptMenuActions.itemByID(8463).invoke();
                  }catch(e){$.writeln(e.message)};
                  

                   

                  No, I do not think, that you can open the options panel directly.

                   

                  I tested both of your script menu actions with InDesign CS5.5. No way (for me) to get the options panel open and let it stay open…

                   

                  Uwe

                  • 6. Re: Re: Re: Re: I want to open "Paragraph Style Options" dialogue using Script(jsx)
                    kapoor_aman27 Level 1

                    This line is working for me. I am using Win7, Indesign CC Release version