Process
Operators and functions for working with processes and applications are described here. The Args and ArgCount functions work with any command line format. For the correct operation of other Arg... functions, the command line must have the following format.
Operators
Operator
Result
Description
$ command line
Executes the command line.
str = $ command line
Executes the command line and returns its output.
Functions
Arg(str name) str
The Arg function returns the value of the parameter with the specified name. If the parameter was not specified at the start of the script, an empty string will be returned. You can omit the initial character - in the name parameter.
Arg(str name, str def) str
The Arg function returns the value of the parameter with the specified name. If the parameter was not specified at the start of the script, def will be returned. You can omit the initial character - in the name parameter.
Arg(str name, int def) int
The Arg function returns the numeric value of the parameter with the specified name. If the parameter was not specified at the start of the script, def will be returned. You can omit the initial character - in the name parameter.
ArgCount() int
The ArgCount function returns the number of command line parameters with which the script was run.
Args() arr.str
The Args function returns a list of all command-line parameters and options with which the script has been run.
Args(str name) arr.str
The Args function returns a list of parameter values named name. You can omit the initial character - in the name parameter.
ArgsTail() arr.str
The ArgsTail function returns the list of command line parameters after the options. You can explicitly specify the beginning of such parameters with -.
IsArg(str name) bool
The IsArg function returns true if the command line has an option with the specified name. Otherwise, it returns false. You can omit the initial character - in the name parameter.
Open(str path)
The Open function opens a file, directory, or URI using the OS's default application for that object type. Don't wait for the open command to complete.
OpenWith(str app, str path)
The OpenWith function opens a file, directory, or URI using the specified application. Don't wait for the open command to complete.
Run(str cmd, str params...)
Optional parameters
buf stdin - the buffer that will be passed to the application as standard input.
buf stdout - the buffer into which the standard output of the application will be written.
buf stderr - the buffer into which the standard error output of the application will be written.
The Run function starts the specified cmd program with parameters and waits for it to finish. Additionally, you can override the standard input and output.
SplitCmdLine(str cmdline) arr.str
The SplitCmdLine function parses the input string with command line parameters and returns an array of parameters.
Start(str cmd, str params...)
Optional parameters
buf stdin - the buffer that will be passed to the application as standard input.
The Start function starts the specified program cmd with parameters and runs the script further. Additionally, you can pass the buffer as standard input.
Last updated