6 Replies Latest reply on Apr 9, 2013 5:55 AM by JADarnell

    (IDCS6 Javascript) Where can I find a list of eventTypes

    JADarnell Level 1

      I am new to Javascripting, so I am still trying to learn where everything is in the documentation. 


      I have figured out that I probably need to use an eventListener in order to make something happen (I am assuming that an eventListener is the same as an observer in the C++ SDK).  I cannot, however, find a list of "eventType"s for use in the first parameter of the addEventListener function call.  To be specific I want to open a new dialog when the user selects a particular radiobutton.


      I think I need two things to figure out this puzzle:


      I need to know where a list of eventTypes may be found for each widget, and


      I need to be able to examine an example of how eventListeners are actually used in InDesign CS6 Javascript.


      I did a search on sample scripts and found no examples.


      Please be advised that this is a CS6 project on the Mac.

        • 1. Re: (IDCS6 Javascript) Where can I find a list of eventTypes
          Olav Kvern Level 1

          Hi JADarnell,


          It all depends on what you're asking, exactly. When you say you want to open another dialog when the user selects a radio button, we need to know how you're creating the dialog in the first place. There are two main ways to do this--1.) using InDesign's built-in dialog object, or 2.) using ScriptUI, which is an ExtendScript object. How can you tell which is which? If you're using app.dialogs.add() to create the dialog box, you're using the InDesign object; if you're not, you're using ScriptUI.


          If you're using the InDesign dialog object (in the ESTK, open the Object Model Viewer, then select the InDesign DOM corresponding to your version of InDesign), then you can't really do this without closing the original dialog box--all InDesign dialogs are modal. While you can, apparently, attach event listeners to the InDesign dialog object, I've never done it for precisely this reason. I'll take a look as soon as I get a few minutes.


          If you're using ScriptUI (in the ESTK, open the Object Model Viewer, then select the ScriptUI DOM), refer to the "User Interface Tools" section of the JavaScript Tools Guide (in the ESTK, choose Help>JavaScript Tools Guide to display this PDF). The reference section on the radiobutton control refers to an onClick event and to a notify() method. Unfortunately, most of the ScriptUI examples use resource strings to define dialog boxes, which is, in my opinion, the worst way to do it--but you can still search the SDK examples (they're in the Samples folder inside the SDK folder in the folder containing the ESTK application) for "onClick" to see some examples.





          • 2. Re: (IDCS6 Javascript) Where can I find a list of eventTypes
            JADarnell Level 1

            Hello Ole: 


               It's nice to hear from you after so long.  You helped me with an extremely large Applescript project years ago (just about the time we were allowed to make an Applescript larger than 32kb as a matter of fact--that dates the project, I'm sure).  Anyway I'm glad to see you are still around to help out.


               I am using InDesign's built-in dialog object; that I know for sure.  I am just beginning to learn how to do anything more complex than throw up an alert so I am in the intense learning mode right now. 


               I took a quick look at the ScriptUI documentation in the InDesign Scripting Tutorial and found the documentation to be so scanty as to be useless, which is why I went back to the dialog object.  I see that you have recommended a better source for learning the SUI object.  I will look at it.  Hopefully, it will set me on the right path.  I will keep in touch.


            Thanks for your very complete offer of help.




            • 4. Re: (IDCS6 Javascript) Where can I find a list of eventTypes
              Olav Kvern Level 1

              Hi John,


              Nice to know that you remember me! This forum basically doesn't--after I left Adobe, I had to get a new Adobe ID. Which is why I seem to have only posted <25 messages.:-)


              Sadly, I'm mostly too busy *using* InDesign scripting to get here, these days.


              Sorry about the ScriptUI examples in the InDesign tutorial. My thinking was that ScriptUI had so many examples of its own that I didn't need to add more in the InDesign-specific scripting documentation. But I agree that it's hard to sort out which DOM is which! I'm also not sure of the state of many of the examples--most of that was taken on by other people from CS 5.5 on (I was working on the CS Extension Builder, at that point). It doesn't really look like many of them have been touched since then.


              Peter Kahrel's ScriptUI documentation is really good--as is everything else Peter does--thanks to Larry G. Schneider for providing a link.





              • 5. Re: (IDCS6 Javascript) Where can I find a list of eventTypes
                JADarnell Level 1



                   I have always maintained that the better you know the documentation, the more it can help you.  For example, when I first purchased Borland Builder for personal use (was it really 20 years ago?) I suffered horribly trying to figure out how to use their DBMS system through their documentation.  After fighting the docs for five years or so, I became a whiz at tracking down what I needed to know.


                   I suspect the same is true of Javascript. After I read your addition to the conversation yesterday I went to the ESTK, opened the PDF you cited and found all the information I needed.  It was just a matter of knowing where to look and you helped with that.  So I appreciate your contributions.


                   BTW, as an aside, and offline of course, I am anxious to exchange SF notes with you.  If and when you have the time, drop me a line.  I still have a large collection of Fanthorpe novels on my bookshelf, thanks to your recommendation.


                Take care,


                • 6. Re: (IDCS6 Javascript) Where can I find a list of eventTypes
                  JADarnell Level 1

                  Thank you, Mr. Schneider for your pointer to that very fine document.  I have downloaded it and will keep it close.