0 Replies Latest reply on Jul 13, 2014 3:22 AM by sanjascreenname

    Cannot delete the target of an active script event

    sanjascreenname

      I am writing a script that uses threeview.

      In threeview I add document names (node) and page numbers (item).

      I added a button that when clicked adds selected document page to selected frames of the document.

      I use "afterSelectionChanged" event which I added to the document. This event calls a function in which I want to place selected PDF document to selected frame.

       

      This is the part of the function that is throwing errors:

      var mySelection = app.documents.item(0).selection;

      for(var myCounter = 0; myCounter < mySelection.length; myCounter++){          

                if (mySelection[myCounter].constructor.name=='Rectangle') {

                              try {

                                          mySelection[myCounter].place(g.doc);

                              } catch (Error) {

                                   alert (Error);

                                  }

                } else if (mySelection[myCounter].parent.constructor.name=='Rectangle') {

                              try {

                                          mySelection[myCounter].parent.place(g.doc);

                              } catch (Error) {

                                             alert (Error);

                                  }

      }

      All the time I get the message “Cannot delete the target of an active script event”, even dough the

      ev.currentTarget before place is [objectDocument].

      Please HELP, I have no more ideas!!!