open
This function opens a file name with the default application as configured in the operating system or graphical user interface.
The application runs in a different process and B4P will not wait until the process has ended, allowing to open multiple files at the same time.
For example Excel files with file type .xlsx could be opened with Excel, and .html files with the default web browser.
Opening .b4p programs will start them as separate and independently running processes. When specifying multiple B4P files, then all of them
will be opened as new tasks with new terminal windows.
Note: Do not include quotation marks in the path or file name, e.g. with help of the quote path() function.
Note: The default web browser is the one configured in the operating system settings and not B4P, e.g. using the browser() function.
Indirect parameter passing is enabled.
The choice of applications may differ among operating systems and supported applications
Min 0
No. | Type | Description |
---|---|---|
1, ... input |
string | File name The specified file will be opened. Add further file names into futher function parameters in order to open them, too. |
Type | Description |
---|---|
numeral | Return code The return code of the last file opened will be provided. Typically, 0 refers to successful outcome. -1 is returned if no system command has been executed. |
path[] = quote path("Examples/*table_lookup*.*");
echo("Path used for directory: ", path[]);
if (system info[operating system] = Windows)
{
a[] = system( "dir /w /b " + path[] );
}
else // Linux, MacOS
{
a[] = system( "ls " + path[] );
}
echo("Return value is ", a[] );
Path used for directory: Examples\*table_lookup*.*
LIB_Function_table_lookup.b4p
LIB_Function_table_lookup_fast.b4p
LIB_Function_table_lookup_once.b4p
LIB_Function_table_lookup_smart.b4p
LIB_Function_table_lookup_smart_once.b4p
LIB_Function_table_lookup_with_rules.b4p
LIB_Function_table_lookup_with_rules_once.b4p
Return value is 0