An IF hot code encloses a block of text or hot codes with the conditions of a logical expression. At run-time when the shortcut is expanded, Asutype will check the condition of the IF expression, and only apply the enclosed block of text or hot codes if the condition is true. Otherwise the block of text or hot codes will be ignored.
Code | Action | Example |
<IF:(logical-expression)>a block of normal text or other hot codes</IF> | Apply the block of normal text or other hot codes if the condition in the logical-expression
is true. Ignore the block of normal text or other hot codes if the condition in the logical-expression is false. |
See more information below |
Logical Expression
Logical expressions are Boolean operations used in <IF> hot code to make a block of text wrapped by <IF> and </IF> codes conditional. A logical expression used in <IF> must be enclosed in a () tag pair. Asutype supports the following Boolean operators:
Operator | Meaning | Example |
= | Equality check: the result is true if the two sides are equal; otherwise it is false. | Yes = Yes is true Yes = No is false |
# | Inequality check: the result is true if the two sides are different; otherwise it is false. | Yes # Yes is false Yes # No is true |
< | "Less than" check: the result is true if the left hand side is less than the right hand side; otherwise it is false. | 2 < 4 is true 2 < 1 is false |
<= | "Less than or equal" check: the result is true if the left hand side is less than or equal the right hand side; otherwise it is false. | 2 <= 2 is true 2 <= 1 is false |
> | "Greater than" check: the result is true if the left hand side is greater than the right hand side; otherwise it is false. | 3 > 1 is true 3 > 5 is false |
>= | "Greater than or equal" check: the result is true if the left hand side is greater than or equal the right hand side; otherwise it is false. | 6 >= 4 is true 6 >= 8 is false |
& | Logical AND: the result is true if both sides are true; otherwise it is false | (3 > 1) & (Yes = Yes) is true (3 > 5) & (No = No) is false |
| | Logical OR: the result is true if any side is true; otherwise it is false | (3 > 1) | (Yes = No) is true (3 > 5) | (No # No) is false |
Notes:
A CASE hot code will run the enclosed block of text or hot codes if the case's condition is right.
Code | Action | Example |
<CASE:variable=value> a block of normal text or other hot codes </CASE> | Apply the block of normal text or other hot codes if the variable has the correct value. | <ASK:name><CASE:name=Joe>Hello Joe</CASE> will ask you to enter a name and print "Hello Joe" if the entered name is Joe. |
Notes:
A REPEAT hot code will run the enclosed block of text or hot codes repeatedly up to the number of times specified in the code.
Code | Action | Example |
<REPEAT:number-of-times> a block of normal text or other hot codes </REPEAT> | Apply the block of normal text or other hot codes repeatedly number-of-times times. | <REPEAT:2>hello </REPEAT> will print "hello " twice. |
Notes:
The following codes control the flow of the shortcut expansion.
Code | Action | Example |
<GOTO:label> | Continue the shortcut from the position of the next comment code <;label>. The block of text or code from this GOTO to the next <;label> will be ignored. | |
<BREAK> | Stop repeating the <REPEAT> code and continue with the block of text or hot codes after the </REPEAT>. | |
<PAUSE> | Stop the typing, put up the Pause box and waits until you either click the "Resume" or "Stop" button | <OPEN:long-and-may-need-some-clicks.exe><PAUSE>
will launch the application whose initialization is long and may need to a few clicks (to pass some dialog boxes at the start of the application, for example) and pause the text until you click the "Resume" button. |
<STOP> | Stop the shortcut expansion | <LET:my-choice={CHOOSE}
stop|continue><IF:({my-choice}=stop><STOP></IF> will ask you to choose between two options: stop and continue. If you choose option "stop", the shortcut will end there. |
<DELAY:number-of-milliseconds> | Stop the typing for a short period of milliseconds. This code is often used to wait for the target document to finish its task and be ready for the next action. |
<DELAY:500> will delay the typing for half a second. <Ctrl+O><DELAY:500>my-file.txt<RETURN> will activate the Windows Open File dialog box, give it half a second to finish drawing itself, then type "my-file.txt" into the Open file box, then press the Enter key to open the file. |