# parse

Executes commands from a file

Usage

    parse [-q] [-e] [-f] [-r] <filename> [<parameter1> [<parameter2> [...]]]

Description

Executes commands from the external file <filename>.
<filename> can be an absolute or relative path.
If it is a relative path then KVIrc will try to look it up in the path of the calling script (if any) and in the current KVIrc working directory. The file must be utf8-encoded (see below). [parameters] is a space separated string of parameters to be passed to the script. The parameter $0 will contain the path of the file being parsed, the other parameters will be available starting from $1.
If <filename> is an existing directory name a file dialog will pop up, allowing you to choose a file to parse. The file dialog will start in the directory specified by <filename>. If you don't know the name of an existing directory, just pass "." or "/". The command just prints a warning if the file cannot be loaded for some reason. If you want the command to stop with an error in this case then use the -e switch.
This command has a builtin alias called include.
Note that script files, especially the ones that you distribute, MUST be encoded in utf8. Any other encoding (especially the exotic ones like KOI8R or Shift-JIS) may screw things up. The reason for such a constraint is simple: KVIrc has no means of knowing the encoding that one or other scripter uses to edit his files. Unlike other languages (like HTML, for example) there is no "external" metadata that will allow for encoding detection before the data is actually decoded. UTF8 is the right way (tm). Use it.

Switches

-e | --fail-on-load
Causes the command to terminate with an error when the file can't be loaded: the error termination stops the parsing of the current script too. If the -e switch is not used then file load failures are eventually reported only as a warning or not reported at all (if -q is used).
-f | --fail-on-error
Causes the command to terminate with an error when the execution of the script loaded from disk generates an error. This error termination stops the parsing of the current script too. If the -f switch is not used then the loaded script errors do not stop the current script.
-q | --quiet
Causes the command to run quietly without printing warnings about empty <filename> and file loading errors.
-r | --propagate-return
Causes the return value of the script to be propagated to the calling context. This allows the usage of ${ } trick to extract this return value. See the examples section for a sample usage.

Syntax Specification

    parse [-q] [-e] [-f] [-r] <filename:string> [<parameter1:variant> [<parameter2:variant> [...]]]

Examples

        parse /home/pragma/myscript.kvs

        # Here we are assuming that fetchdata.kvs returns a string
        # We evaluate the return value thru ${} and echo it
        echo ${ parse -r /home/pragma/fetchdata.kvs; };

Index, Commands

KVIrc 4.2.0.6190 Documentation
Generated by portbuild at Mon Aug 12 23:49:50 2013