9 Replies Latest reply on May 23, 2014 12:08 AM by Laubender

    Opening the document setup dialog window

    schiuma24 Level 1

      how can i open the document setup dialog window with javascript!?!

        • 1. Re: Opening the document setup dialog window
          Jump_Over Level 5

          Hi,

           

          Open and exit?

           

          app.menuActions.itemByID(24833).invoke();
          

           

          Jarek

          • 2. Re: Opening the document setup dialog window
            hasvi Level 1

            Hi,

             

            You have done a good job, I am the beginner of Indesign script. I have one doubt about your script

            where did you get the value of '24833' and what is the meaning of 'invoke()'

            Can you please explain me?

             

            by

            hasvi

            • 3. Re: Re: Opening the document setup dialog window
              Jump_Over Level 5

              Hi,

               

              There is more than 3000 menuActions (CS5) available to execute using UI menu, panels menu, "right-click" menus, and so on.

              Using invoke() method one can execute menuAction alike UI user do by click.

               

              Sometimes there is no other way to reach an InDesign feature but menuAction.invoke() ==> no properties/method open for scripting

               

              You can store a list of menuActions in this sample document:

              #target indesign
              var
                mMenuAct = app.menuActions.everyItem().getElements().reverse();
                len = mMenuAct.length;
                mStr = "ID\tname\tarea\r";
              
              while (len-->0)
              mStr += mMenuAct[len].id + "\t" + mMenuAct[len].name + "\t" + mMenuAct[len].area+ "\r" ;
              
              var mFrame = app.documents.add().textFrames.add({
                geometricBounds: app.activeDocument.pages[0].bounds,
                contents: mStr
                });
              
              with (mFrame.textFramePreferences) {
                textColumnCount = 2;
                insetSpacing = [
                app.activeDocument.pages[0].marginPreferences.left,
                app.activeDocument.pages[0].marginPreferences.top,
                app.activeDocument.pages[0].marginPreferences.right,
                app.activeDocument.pages[0].marginPreferences.bottom ];
                }
              var mTable = mFrame.parentStory.texts[0].convertToTable();
              mTable.rows[0].rowType = RowTypes.HEADER_ROW;
              

              Jarek

              • 4. Re: Opening the document setup dialog window
                hasvi Level 1

                Hi,

                 

                thanks for your valuable answer.

                 

                by

                hasvi

                • 5. Re: Opening the document setup dialog window
                  ASHOK KUMAR Level 1

                  Hi

                   

                  If anything possible to add 2 or more functions.

                  like Open document setup and Margin and columns etc.,

                   


                  • 6. Re: Opening the document setup dialog window
                    ASHOK KUMAR Level 1

                    Hi Jumb_over

                     

                    If anything possible to add 2 or more functions.

                    like Open document setup and Margin and columns etc.,

                     

                    by

                    Ashok kumar

                    • 7. Re: Opening the document setup dialog window
                      Jump_Over Level 5

                      Hi Ashok Kumar,

                       

                      You can execute any of >3k actionMenus. Just use a list from post above, change ID and invoke()

                       

                      Jarek

                      • 8. Re: Opening the document setup dialog window
                        ASHOK KUMAR Level 1

                        Hi Jarek

                         

                        Fine. Thanks for your prompt reply.

                         

                        I like one script, get 2 or more functions It means,

                        ________________________________________

                        app.menuActions.itemByID(24833).invoke(); 

                        app.menuActions.itemByID(6146).invoke(); 

                        ________________________________________

                         

                        In above case

                        Set Open Document setup +  set Margin and columns in one script.

                         

                        It is possible.

                        • 9. Re: Opening the document setup dialog window
                          Laubender Adobe Community Professional & MVP

                          @Ashok – That's not so easy. Opening a menu with prepopulated values means, that you have to set some generic values, some values in preferences.

                           

                          And most of the time to do that you have to manipulate preferences of the app object itself.

                          You have to decide, if these changes are permanent for the user, eg. every time I open the document setup window I, the user, will be presented with the new values from now on (after running a particular script). And in most cases that will be a somehow disturbing user experience.

                           

                          Or I play save and restore all manipulations after running the main part of the script. But in case of opening a dialog like "Document Setup" with predefined values, the script has no chance to reset the preferences, because opening that script will block everything until the user decided to say ok to the dialog.

                           

                          So you would need another part of the script, an event script, that checks silently in the background, if the user added a new document and then reset the preferences. A quite complex task. Or you need quite another script that goes into a startup scripts folder and will restore the app preferences every time you start InDesign.

                           

                          So, I think it would be better not to present a prepopulated generic "Document Setup" dialog, but instead creating a new preset for a new document that the user can select. And if already created, the user ran your script already at least once, looking after the preset and chose that.

                           

                          Ah. And to help you with that, we need a bit more. What would the values be? Should it be a single-sided document? A double-sided one? What document intent? Print based? Web based? Digital Publishing based?

                           

                          And what is the overall benefit for that exercise, if a user can punch in these values in less than 20 seconds?

                           

                          Uwe