5 Replies Latest reply on May 7, 2014 11:21 PM by gert verrept

    list of names

    gert verrept Level 2

      As a non scripter (I can modify existing scripts) I need help with this question: I'm looking for a javascript that lets me put one or more titles (ex. minister of Defense, minister of Finance) in a particular para style (minister+30mm) at the insertion point of the cursor.

      What I need: a list of titles (I thought about 15 titles but t can be more or less) to select from (one or several) and that list should be put at the insertion point of the cursor but in the order the were selected. It can be that title3 comes before title1 (importance issue).

      We are running on win7 with CC. Note: the script will have to be run twice, once on the Dutch side and once on the French side.

      thnakx for any suggestions, Gert

        • 1. Re: list of names
          Roy Marshall Level 1

          Hey Gert.

          Is it possible to send some screen shots of what you want to achieve? It is hard for me to visualise what you are asking for here.

          It sounds like something that can be achieved...

           

          Roy

          • 2. Re: list of names
            gert verrept Level 2

            @Roy: Sorry for the delay. I don't have a screen shot for what I want, but I've a similar example. Here, the goal was to have a complete title of a committee on the first page. What I want now is, at the "x" in the screen shot, ADD several titles one below the other (so it must be possible to click several times "add" without restarting the script. I hope this makes more sense now. The complete titles for these committees are hardcoded in the javascript (they don't change anyway).

            Exforlist.jpg

            • 3. Re: Re: list of names
              Jump_Over Level 5

              Hi,

               

              I suggest to use "palette" type of window and listBox instead of dropDownList (with scrollbar).

              In a code below doubleClick involves inserting text and "delete last" button removes the last line in text box.

              "Finish" button closes a palette window

               

              #target indesign
              #targetengine mDialog
              var
                mTitles = ["TitleOne","TitleTwo","Title3","Title4","Title5","Title6","Title7","Title8", "Title9"],
                w = new Window ("palette","Title multiselector", undefined);
              
              w.alignChildren = "left";
              w.add("staticText", undefined, "Doubleclick to choose and add. \r'Delete' button removes last added", {align:"left",multiline: true,closeButton: false});
              
              var
                body = w.add("group"),
                mList = body.add("listbox",undefined,mTitles,{scrollbar: true}),
                mButt = body.add("group");
                mButt.orientation = "column";
                mButt.alignment = "bottom";
                mButt.add("button", undefined, "Delete last");
                mButt.add("button", undefined, "Finish");
              
                mList.preferredSize = [200,150];
              
                mList.onDoubleClick = function() {
                   app.selection[0].contents = mList.selection.text + "\r";
                   }
                mButt.children[1].onClick = function() {
                   w.close();
                   }
                mButt.children[0].onClick = function() {
                   app.selection[0].parentStory.lines[-1].remove();
                   }
                if (app.selection[0].constructor.name == "InsertionPoint") w.show();
                else {
                   alert("Make a cursor active inside desired text box");  exit();
                   }
              

               

              dropDownList could be used however choosing element is easier in listBox, in my opinion.

              Jarek

              • 4. Re: list of names
                gert verrept Level 2

                Thankx,

                I tested it and it works just the way I was expecting it to work.

                Gert

                • 5. Re: list of names
                  gert verrept Level 2

                  @jarek: After some extensive testing and some fine tuning of the masters, it's a great script. It saves a lot of time, no more fear for typo's, less correcting needed so speeds things really up. Thanks a lot for the help.

                  G