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

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


en:documentation:expressions

Различия

Показаны различия между двумя версиями страницы.

Ссылка на это сравнение

Предыдущая версия справа и слеваПредыдущая версия
Следующая версия
Предыдущая версия
Последняя версияСледующая версия справа и слева
en:documentation:expressions [2020/04/07 19:49] loopbacken:documentation:expressions [2020/04/07 19:56] loopback
Строка 1: Строка 1:
 ====== Expressions ====== ====== Expressions ======
  
-Выражения используются в [[conditions|условиях]]. Начиная с версии 2.0.10 вычисляемые выражения также могут использоваться во всех параметрах команд Autorun. +Expressions are used in [[conditions|conditions]]. Starting with version 2.0.10, calculated expressions can also be used in all parameters of Autorun commands.
  
-Для использования в параметрах команд необходимо чтобы параметр был в кавычках и непосредственно перед ними  +For use in command parameters, the parameter must be in quotation marks and immediately before them 
-стоял знак "%"В этом случае текст будет трактоваться как вычисляемое выражениеНапример:+there was a "%" signIn this case, the text will be treated as a calculated expressionFor example:
  
 <code> <code>
 Set Delay 500 Set Delay 500
 Sleep %"1000 + %Delay%" Sleep %"1000 + %Delay%"
-результат вычисления - 1500.+result = 1500.
 </code> </code>
  
-Внутри кавычек для текстовых константкак и вездеможно использовать кавычки другого типа:+Inside quotes for text constantsas elsewhereyou can use quotes of a different type:
 <code> <code>
-Set sl 1000  +StrLen var %'"String_" & 1'  
-StrLen var %'"Строка_" & 1'  +# var => String_1
-# var => Строка_1+
 </code> </code>
  
-Хотя в выражениях могут использоваться текстовые константыне обернутые в кавычки, такой вариант оставлен только для совместимостиНастоятельно рекомендуется использовать кавычки повсеместноЭто значительно уменьшит число возможных ошибок.+Although text constants that not wrapped in quotation marks can be used in expressionsthis option is left for compatibility purposes onlyIt is highly recommended that you use quotation marks everywhereThis will significantly reduce the number of possible errors.
  
 Arithmetic operations, the concatenation operation "&" of strings, and logical operations can be used in expressions. Arithmetic operations, the concatenation operation "&" of strings, and logical operations can be used in expressions.
Строка 29: Строка 28:
 Brackets and AND, OR, and NOT operators are also allowed. True/False keywords are allowed, which are equivalent to the strings "1"/"0", respectively. Brackets and AND, OR, and NOT operators are also allowed. True/False keywords are allowed, which are equivalent to the strings "1"/"0", respectively.
  
-Приоритет выполнения операцийот высшего к низшему:+The priority of operationsfrom highest to lowest:
  
 <code> <code>
Строка 40: Строка 39:
 </code> </code>
  
-**Использование команд в выражениях**+**Using commands in expressions**
  
-В выражениях возможно использование любых команд Autorun, но смысл имеет использование техкоторые возвращают результат+It is possible to use any Autorun commands in expressionsbut it makes sense to use those that return a result. 
 + 
 +To use a command as a function in an expressionit must be written using brackets and a comma as a parameter separatorThe first parameter (variable name for the return value) is not used in this case. If you need to use the switches, you need to pass them in the first parameter, in quotation marks separated by a space, the parameter text should begin with the character "~". In general, the entry looks like this:
  
-Для использования команды в качестве функции в выражении, она должна быть записана с использованием скобок и запятой в качестве разделителя параметров. Первый параметр (имя переменной для возвращаемого значения) в этом случае не используется. Если нужно использовать переключатели, их нужно передавать в первом параметре, в кавычках через пробел, текст параметра должен начинаться с символа "~". В общем виде запись выглядит так: 
 <code> <code>
 CommandName(["~/S1 /S2 .. /SN",] Param1, Param2, .. , ParamN) CommandName(["~/S1 /S2 .. /SN",] Param1, Param2, .. , ParamN)
 </code> </code>
  
-Пример:+Example:
 <code> <code>
 Set zz "AbCdEfxQWERTY"  Set zz "AbCdEfxQWERTY" 
Строка 56: Строка 56:
 </code> </code>
  
-В выражениях можно использовать вложенные команды:+You can use nested commands in expressions:
 <code> <code>
 Set zz "  abcdefgh"  Set zz "  abcdefgh" 
Строка 62: Строка 62:
 # => abc-6-5  # => abc-6-5 
 </code> </code>
- 
- 
- 
- 
- 
- 
-Variables are always expanding in the expressions. If you assume that variable value can conatin spaces, wrap expression in quotes. Example: 
- 
-<code> 
-If ("%var_with_spaces%" = "value") Then 
-</code> 
- 
-Also, some special functions can be used in comparison. In this case comparison limited to only one function. 
- 
- 
-<code> 
-If [Not] Function1 <parameters> Then 
-  ... 
-ElseIf [Not] Function2 <parameters> Then 
-  ... 
-Else 
-  ... 
-EndIf 
-</code> 
- 
-It's allowed to use both expressions and function in one condition (but in different branches). 
  
en/documentation/expressions.txt · Последнее изменение: 2020/04/24 16:29 — loopback

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki