Microsoft KB Archive/196385

= HOWTO: How to Terminate a Visual FoxPro .exe Using Apple Script =

Article ID: 196385

Article Last Modified on 12/11/1999

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0b for Macintosh

-



This article was previously published under Q196385



SUMMARY
This article shows how to terminate or quit a running Visual FoxPro for Macintosh executable from another application using AppleScript.



MORE INFORMATION
Normally you would use AppleScript to call the Quit command from the File menu to close the application. When you run a distributed Visual FoxPro application, the Quit option on the File menu is not available. However, most distributed Visual FoxPro applications do contain a READ EVENTS in the code to start event processing and prevent Visual FoxPro from exiting prematurely. The AppleScript example is based on using a CLEAR EVENTS to cause the executable to exit.

NOTE: This example creates an AppleScript that you can execute from the Macintosh Finder or another application that can run AppleScript.

Steps to Reproduce Behavior
 Create a Visual FoxPro for the Macintosh executable that either has a READ EVENTS in a menu or form.  Open the AppleScript Editor and type in the following test: Tell Application "VFP Support Library PPC" Do Script "Clear Events" End Tell  Save the script and call it "Quit VFP EXE". In the Kind option of the Save Script as dialog box, choose Application. You may also want to select the Never Show Startup Screen check box. Quit the Script Editor. Close Visual FoxPro. Run the Visual FoxPro for the Macintosh executable from the Finder. At the Finder, double-click the "Quit VFP EXE" Application script. The executable closes.

AppleScript is manufactured by Apple Computer, a vendor independent of Microsoft; we make no warranty, implied or otherwise, regarding this product's performance or reliability.

