Using this command, you can run any program (.exe), batch file (.bat) or call file with any registered extension that can be viewed by some external program. For example, HTML files will be started in an associated web browser (typically IE) or for example MP3 files will be started in associated audio player (e.g. WinAmp).
Command has one required and one optional parameter:
Run("FolderPath-FileName","Parameters-Arguments")
1) program folder path & file name is required
2) Run command parameters or program arguments are optional
Program folder path & file name - either relative (using file path macros) or fixed path with name of file you want to run.
Run command parameters - handle behaviour of executed file and your project when that file is run. 6 comma separated (but without an empty space!) parameters are available:
TOP - executed program will always start on top of the source application (your project), but clicking on another window will move program's window to the background (behind selected window). Setting delay value (in milliseconds) inside parenthesis will pause putting program's window on top. For example: TOP(2000) will wait 2 seconds before setting top position for program's window.
TOPMOST - executed program will be kept on top of all windows (until some other application takes TOPMOST position).
Setting delay value (in milliseconds) inside parenthesis will pause putting program's window on top of all others. For example: TOPMOST(2000) will wait 2 seconds before setting top position for program's window.
WARNING!If you run any application with TOP/TOPMOST flags, MMB always wait until the application initialize (an infinite time). It can be potentially dangerous in cases when the external application cannot start (from any reason), because it can freeze the MMB completely. Therefore, there is an option to set a timeout value to continue with MMB application after a number of milliseconds, no matter if the external application is already initialized or not.
Using the timeout value is required if you use TOP/TOPMOST flags on some nonstandard applications without the "message queue" (for example command.com, cmd.exe or just the bat files, which in fact runs command.com/cmd.exe system apps).
WAIT - your MMB project will wait for run application to finish (close) before any further code line is performed. Useful for calling external encoders, compressors, encryptors and similar programs that require unpredictable amount of time for data processing. Using WAIT parameter, your project won't go out of synchronization with external program.
MAXIMIZE - Activates application's window and displays it as a maximized window.
MINIMIZE - Displays application's window in a minimized mode (i.e application is minimized in Windows taskbar). The project window (MMBuilder) remains active, but only without WAIT parameter.
HIDE - Hides application's window and activates another (main project) window. This parameter is useful if you don't want to display the application window even in minimized mode (for example if you run the bat files). This will start the application with completely hidden main window.
WARNING!!! Be careful with using HIDE parameter, mainly together with WAIT parameter! If application with HIDE and WAIT parameters will not be automatically finished (i.e. without user's input) it will freeze the MMB application! For example, don't use "Pause" command in your bat files if you want to process these files with HIDE&WAIT parameters.
You can use all the above parameters together, separated by comma (without an empty space), but some combinations are useless (e.g. HIDE/MINIMIZE&TOP/TOPMOST):
Run("<SrcDir>\MyApp.exe","TOP(2000),WAIT")
Arguments - various parameters specific to program you're running. For example, running of Notepad can be argumented with name of file you want to run, making it automatically opened upon Notepad run:
Run("<Windows>\notepad.exe","<Windows>\win.ini")
If you want to run Notepad with a text file as a parameter, and with TOPMOST and WAIT, you will have to use this notation...
Run("<Windows>\notepad.exe","WAIT,TOPMOST <Windows>\win.ini")
In other words, first empty space used in second Run command parameter is used as a separator of MMB internal parameters (like WAIT, TOPMOST, etc.) and the program arguments (in this case path to <Windows>\win.ini).
|