parse Executes commands from a file |
||||||||
Usage |
||||||||
parse [-q] [-e] [-f] [-r] <filename:string> [<parameter1:variant> [<parameter2:variant> [...]]] |
||||||||
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 UTF-8-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 UTF-8. 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. UTF-8 is the right way (tm). Use it. |
||||||||
Switches |
||||||||
|
||||||||
Examples |
||||||||
parse /home/pragma/myscript.kvs | ||||||||
# Here we are assuming that fetchdata.kvs returns a string # We evaluate the return value through ${} and echo it echo ${ parse -r /home/pragma/fetchdata.kvs; }; | ||||||||