exec (string program, string options, int mode)
Opens an external program, document, URL, or batch file.
program - file name of the exe, batch file, or document, or URL to be opened.
options - command line parameter string to be passed to the program, or 0 for no command line options.
mode - 1 for waiting until the external program was terminated, otherwise 0.
0 if the program was not found or could not be started, nonzero otherwise. When mode was 1, the return code of the program.
- The program parameter can specify a full path (from the root), a partial path (from the Zorro folder), or just a filename. In the latter case the exec function first looks for the file in the Zorro folder, and then in the in the folders specified by the system's PATH environment variable.
- If the program string does not have a filename extension, the exec function first tries the .COM extension, then the .EXE extension, then the .BAT extension, and finally the .CMD extension.
- If the program string contains a URL or the name of a document, the standard internet browser or the standard editor for that document is opened.
- '\' characters in strings, like for file paths, have to be given in C-Notation as "\\".
- The external program can be controlled with the keys function.
exec("notepad","test.txt"); // open notepad
exec("c:\\programs\\internet explorer\\iexplore.exe","http://www.zorro-trader.com"); // open an URL with Internet Explorer
exec("http://www.zorro-trader.com",0); // open an URL with the standard browser