Made ScriptWindow.menuDefinition() per-application.

An application must now be passed to ScriptWindow.menuDefinition() to get the definition specific to the application in question. This allows multiple applications to be run in the same process without fighting.