Run, !
RUN, or its equivalent shorthand ! (often spoken as Bang!), allows Visual FoxPro to run other programs. In the Windows version, you can access both Windows and DOS programs.
Usage |
RUN | ! [ /nFreeMemory [K] ] ProgramName && DOS version RUN | ! [Options] WinProgName && Windows version |
Parameter |
Value |
Meaning |
nFreeMemory |
Numeric |
States the amount of memory required in kilobytes. FoxPro for DOS attempts to clear out this amount before invoking the specified program. |
ProgramName |
Name |
The name of the DOS program for FoxPro for DOS to run. |
Options |
Omitted |
Indicates that Visual FoxPro should start the specified program within a DOS box. |
/N or /N1 |
Means "NOWAIT," indicating that this is a Windows program. These settings run the Windows program, making the application active, running it in its "normal" size. "Normal" depends on the application. Many applications store the position they were in when they were last closed, and restore this setting under this "normal" condition. Others always open maximized, minimized, or somewhere in between. |
|
/N2 |
Runs the Windows program as the active application, but minimized. |
|
/N3 |
Runs the Windows program as the active application, in its maximized format. |
|
/N4 |
Runs the Windows program, restoring its normal window size, but does not activate it. |
|
/N7 |
Runs the Windows program, leaving it inactive and minimized. |
|
WinProgName |
Name |
The name of the program, either a DOS or Windows program, for Visual FoxPro for Windows to run. |
RUN /320 wordstar.exe RUN /320K wordstar.exeVisual FoxPro for Windows can run either DOS or Windows applications. If an application is run without the "NOWAIT" option, a DOS application is assumed. If a file extension is not specified, Visual FoxPro first looks for a file with the same program name and the extension PIF. A PIF, or Program Information File, dictates several characteristics of how an application should run. We won't drag you through all the details—check out the Windows manuals or some of the better books in our bibliography for all the gory stuff. If a PIF cannot be found, Visual FoxPro runs FoxRun.PIF, normally located in the \VFP directory, or uses the default settings if this file cannot be found. It is FOXRUN.PIF that makes all of your DOS commands hang around, and your FoxPro session appear that it is locked up, but your alternative is to have your DIR or MEM commands appear and disappear too quickly to be seen. Consider making custom PIFs for commands you use often, and make sure to include them with your application if it needs to be distributed to others.Running Windows programs is a pretty straightforward process. Select whether you would like the application you are running to take over the visual display and become active, or perhaps sit in the background, and set your /N settings appropriately. We often use /N7 to start applications we are going to converse with from FoxPro, using either Dynamic Data Exchange or Automation.
Example |
* Start Excel in the background, minimized RUN /N7 EXCEL.EXE |
See Also |