Launches a program and has it inherit the current environment as set with the EnvironSet command.
RunEnviron(program-name, params, display mode, waitflag)
(s) program-name: the name of the desired .EXE, .COM, .PIF, .BAT, .CMD file, or a data file.
(i) params: optional parameters as required by the application.
(i) display mode: @NORMAL, @ICON, @ZOOMED, @HIDDEN, @NOACTIVATE or 0 for the default mode.
(i) waitflag: @WAIT, @NOWAIT.
(i) @TRUE Function was executed normally.
Use this function to launch a program with the current environment.
Only Windows EXE’s may be executed with this command. It is possible to change the environment for DOS programs by launching a DOS BAT file that includes DOS SET statements to alter the environment settings before executing the DOS program. Use the Run commands to launch DOS programs and BAT files.
This function is identical to the RunShell function.
To alter the path for DOS programs, all that is required is a simple batch file, and the usual WIL Run command. Assuming the case where one wished to run "command.com" with the path "c:\special", a generic batch file as shown below will suffice, along with passing all the information required as parameters in the WIL Run command.
DoPath.bat file listing
SET PATH=%1
ECHO %PATH%
PAUSE
%2 %3 %4 %5 %6 %7 %8 %9
WIL Run Command
Run("dopath.bat", "c:\special command.com")
If the "program-name" has an extension other than .EXE, .COM, .PIF, .BAT or .CMD, it will be run with the associated application.
The @NOACTIVATE value causes the targeted application's window to be displayed in its most recent size and position but without making the application's window the active window when another top-level window is already active.
;Note: Permanent changes may be made by ;using the registry functions to update the registry. ; ;Note that this function will not affect the environment for ; DOS or Console applications ; ;Note: Modifying the path does not allow assist WIL in ;locating the EXE file. The path WIL uses has already ;been pre-determined. However the child process (excel) ;will inherit the PATH environment variable in this case. EnvironSet("PATH","c:\Program Files\Excel\") RunEnviron("c:\Program Files\Excel\Excel.exe","",@NORMAL,@WAIT)
RunShell, Run, RunWait, ShellExecute Environment, EnvironSet