Run a script immediately before quitting application
FMP 11 Advanced for Macintosh
I have a compiled Macintosh FMP application and I would like to be able to run a script immediately prior to quitting the program. Unfortunately, the Quit command on the FMP Mac application pulldown menu (the one just to the right of the Apple menu) is not accessible to any actions after it's chosen. As a matter of fact, the "Preferences", "Services", "Hide XXX", "Hide Others", "Show All" and "Quit XXX" choices are all automatically appended to this pulldown menu when the program is compiled and are not even listed in the Custom Menus screens.
I came close when using File Options - When Closing This File, Perform Script XXX, but the script got activated not only when choosing the Quit command (which was fine), but also when keeping the application open and loading up a new blank user file. I need to be able to run this script only when quitting the app, and not at any other time...and I can't seem to find a unique condition to use that will allow the script to run just at that time, without also getting triggered by other conditions.
I tried putting a custom "Quit XXX" menu entry in the app pulldown menu, and that would work, except there's then no way to get rid of the Quit command that comes automatically from the compile at the bottom of the app pulldown menu.
Is there a way to do this???