AnsweredAssumed Answered

OnWindowOpen subtlety?

Question asked by jreinsch on Jun 28, 2013
Latest reply on Jul 2, 2013 by philmodjunk

Title

OnWindowOpen subtlety?

Post

     There seems to be a subtlety about the OnWindowOpen event that escapes me. Here's what I did:
     File X has two scripts:
     1) WindowOpenTrigger, which appends "WindowOpenTrigger" to a field named "stuff".
     2) AppendParamToStuff, which gets the ScriptParameter and appends it to stuff.

     X has a script trigger for OnWindowOpen; it calls the WindowOpenTrigger script.

     File Y has two scripts:
     1) OpenX, which is just Open File["X"]
     2) SayHelloAndOpenX, which Performs Script "AppendParamToStuff" in X with a parameter "Hello from Y", and then Open File["X"]

     Test 1
     I make sure stuff is empty, close both files, open Y, check that X does not appear in the Window menu, and run OpenX. As expected, stuff contains "WindowOpenTrigger".

     Test 2
     Same steps, but run SayHelloAndOpenX instead of OpenX. This time, stuff contains "Hello from Y" only. A window for Y has clearly been opened, but without the OnWindowOpen trigger being executed. How can this be?

Outcomes