4 Replies Latest reply on Jul 8, 2008 7:42 AM by Martin Fischer

    Waiting for the document after "afterOpen"-event

    Level 1
      Hello all,

      if this has been discussed I have missed it...

      Given the discussion at http://www.adobeforums.com/webx/.59b5727d/4 I thought that it should be possible to ser the default view of a document using the "afterOpen" event.

      I came up with this:

      #targetengine "session"

      function main()
        var myEventListener1 = app.addEventListener("afterOpen",  oppOn, false);
        alert("Installed opp_default");

      function oppOn() {
      app.activeDocument.layoutWindows[0].overprintPreview = true;

      But this only complains that there is no layoutWindow yet.
      Obviously the script is called after the file has been selected but before the window is built.

      Is there some way to wait for the window being built?

      Thank you