Инструменты пользователя

Инструменты сайта


en:autorun:documentation:commands

Commands and functions

:i: In this help, when specifying the parameters of commands and functions in a generalized form, angle brackets are used: <parameter>. If the parameter is optional, it is enclosed in square brackets: [<parameter>].

If the command returns a result, then the first parameter in the command noptation must be a variable. For ease of this help, it is not listed in the parameter list for each function. It is generically specified as <VAR> in uppercase.

Descriptions of commands optimized for use in expressions (that is, those that do not require switches) include both kinds of syntax.

Commands

Each command in Autorun is located on one line and must be at the beginning of it (but whitespace before it is allowed). The command can include required parameters, optional parameters, and switches. The order is regulated as follows: command name, switches, required parameters, optional parameters.

Parameters and switches are separated by a space. If a space is to be used in parameter, the parameter must be enclosed in quotes — double or single. In this case, quotes of a different type can be used in the text of the parameter.

All switches must start with «/» and be in front of any parameters. Switches are intended to change the behavior of a command in relation to its default behavior. Usually, all switches are optional, but some commands require certain switches to be present in order to perform any action.

If the command returns a value, the variable where the result will be written is always placed first in the parameter list (but after the switches).

A number of commands can independently expand environment variables in certain parameters. The fact of support is indicated in the documentation. In this case variables and environment variables can be used directly in the parameter text.

Internal functions

In general, almost any Autorun command can be written as a function. But using the command syntax is often preferable, because for commands with a complex interface, command notation will be shorter and more understandable. However, for functions that return a result, when used in expressions, the functional notation is obviously more logical.

Read more about using commands in functional notation in the section Using Commands and Functions in Expressions.

User Defined Functions

User defined functions are defined using keywords Func and EndFunc. A function can have parameters and return a value.

Like variable names, function names can only consist of Latin letters, numbers, and the underscore character. The function name cannot start with a number. The function name cannot be the same as the builtin command name.

A function call is made by name, similar to calling any built-in function or command. If the name of the called function is not known at startup, the call can be made using the Call or Eval function. The case of the name does not matter.

The function is exited when it reaches its end, or by using the Return keyword with an optional return value. If the function exits without a Return, or if a Return is used without a value, the return value of the function is the empty string.

Custom functions do not support the switches mechanism. In command notation, the switches will be passed as a normal string parameter:

UserFunc /N "str"
 
Func UserFunc(a, b)
  MsgBox(a & b)  # --> "/Nstr"
EndFunc
 
en/autorun/documentation/commands.txt · Последнее изменение: 2022/10/23 23:04 — loopback

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki