4 Replies Latest reply on Mar 11, 2015 2:31 PM by Laubender

    Book Event

    luca cres

      Hello

      I don't undestand how book events work

      i must execute a script before book close but i don't intercept the listener

      can you help me?

       

      _BOOK_LISTINO=app.activeBook

      _BOOK_LISTINO.addEventListener("beforeSave",myfunction)

       

      No events work in book

      can you tell me where i can found some explanations

      Luca

        • 1. Re: Book Event
          Vamitul Level 4

          there is no before save event.

          try BEFORE_CLOSE

          • 2. Re: Book Event
            Laubender Adobe Community Professional & MVP

            @Vamitul – great, you are back!

             

            Hm. Yes: BEFORE_CLOSE.

             

            But this event is only available for inDesign's Document objects, not for Book objects.

            So, I do not think, this will work.

             

            Uwe

            • 3. Re: Book Event
              luca cres Level 1

              yes for me  Book.addEventListener dosn't work

              i try but i can't intercept nothing

              thanks for your answer

              Luca

              • 4. Re: Book Event
                Laubender Adobe Community Professional & MVP
                app.eventListeners.add("beforeClose",doMyThing);
                

                 

                will also not work.

                 

                Only Window objects (layoutWindow, storyWindow) that will be closed and Document objects that will be closed can be listened to.

                No Book objects.

                 

                You could trace what's going on in the JavaScript Console of the ESTK.

                All ExtendScript code:

                 

                #targetengine myBeforeClose-doMyThing
                
                var eventHitCounter = 0;
                var myListener = app.eventListeners.add("beforeClose",doMyThing);
                
                function doMyThing(myEvent){
                
                    var propertyCounter = 0;
                
                    for(x in myEvent){
                        //Writing to the JavaScript Console of the ESTK (ExtendScript Toolkit):
                        $.writeln(eventHitCounter+"\t"+propertyCounter+"\t"+myListener+"\t"+x+"\t"+myEvent[x]);
                        propertyCounter++
                       
                        };
                   
                    eventHitCounter++
                   
                    };
                

                 

                Uwe