Ooops. In copying just a piece of my script file, I inadvertently broke it. Please change "wingApp." to "wingapi.gApplication." Sorry (I'm more used to web forums where you can fix stupid mistakes).