wb_exec
bool wb_exec (string command [, string param])
Opens or executes a command. The string passed to this function can be one
of the following:
- A WinBinder script.
- An executable file.
- A non-executable file associated with an application.
- A folder name. Passing a null or empty string opens the current
folder.
- A help file or help file topic.
- An URL, e-mail, newsgroup, or another Internet client application.
Optional parameters can be passed to the command or application through the variable param.
Running WinBinder scripts
The function wb_exec() is useful for running a WinBinder script as a
separate process. If command has a .phpw extension, this will
be detected by the function and processed adequately. The following non-case-sensitive modifiers
can be used as param:
Param
|
Meaningx
|
"" or empty
|
Run the script in the same mode as the calling process |
"w" or "windowed"
|
Run the script in windowed mode (release mode) |
"c" or "console"
|
Run the script in console mode (debug mode) |
"o" or "open"
|
Ignore the .phpw extension and treat command as
any other string, shell-executing it ¹
|
¹ Usually, shell-executing a .phpw script will usually
run it in windowed mode, unless the user has changed the .phpw association in
Windows.
NOTE: Only .phpw is considered to be a WinBinder script. This
means the .php extension will not be detected by wb_exec() and
will be shell-executed normally.
Examples
// Several methods of running WinBinder scripts
wb_exec("app.phpw");
//
Run a WinBinder script in the same mode as the calling process
wb_exec("app.phpw",
"W"); //
Run a WinBinder script in windowed mode wb_exec("app.phpw",
"windowed"); // Any word
beginning with "W" will do the same
wb_exec("app.phpw",
"C"); //
Run a WinBinder script in console mode wb_exec("app.phpw",
"console"); // Any
word beginning with "C" will do the same
wb_exec("app.phpw", "O"); //
Shell-execute the file instead of treating it like a script wb_exec("app.phpw",
"open"); //
Any word beginning with "O" will do the same
|
Other examples
// Execute an application
wb_exec("app.exe"); wb_exec("cmd"); // Opens a console window
// Open a
web application
wb_exec("http://hypervisual.com/winbinder/");
// Open browser wb_exec("mailto:bill.gates@microsoft.com");
// E-mail client
// Open a non-executable
file
wb_exec(wb_find_file("notepad.exe"), __FILE__); // Use
Notepad wb_exec(__FILE__); // Use
the associated app
// Open a help file
wb_exec(wb_find_file("help/windows.chm")); wb_exec(wb_find_file("hh.exe"),
"winbinder.chm::manual/what_is.html"); //
A help topic
// Open a folder
wb_exec(""); // Open the current folder wb_exec(wb_get_system_info("fontpath")); // Open the OS font folder
|
See also
System functions