ScriptTap
IF

Command video guide

IF

IF chooses which enclosed commands run from values saved earlier in a script. This Overview tours the options without Test or Play. The four mode tabs provide complete working demonstrations.

Keep conditional commands between IF and its matching End IF. A passing decision runs the enclosed section; a failed decision skips it. An optional ELSE provides the failed path and must remain within the same IF/End pair, at most once.

OR passes with at least one true row. AND requires every row to be true. XOR requires exactly one true row, not simply an odd number. Each supports up to five rows; Add Condition appends one, and a divider's red X removes the following row.

Each row has Variable Name, Relationship and Value. Initialize the source first and use compatible types. Value can be a literal or an earlier variable. Relationships include =, <>, >, >=, <, <=, Between and Contains. Between adds a second inclusive bound; numeric bounds are lower then upper, and time-only intervals can cross midnight. Contains tests a text substring; text comparisons ignore letter case. Numeric/Time ordering uses the source variable's type. Ordinary condition rows have no confidence field.

RGB Confidence compares an earlier saved Hex Variable with Target Color; it does not capture the screen. Target Color accepts a six-digit RGB hexadecimal color or an earlier Hex variable. Confidence is a digits-only whole percentage from 1 to 100. Higher is stricter; 100 requires exact RGB equality, while lower values allow more channel variation. Do not enter a fraction, variable or percent sign. Blank remains unfinished. This is deterministic color comparison, not AI or image matching.

Review active-mode values before OK in a real script. This tour cancels its draft and performs no runtime demonstration.

Overview

Step-by-step guide

  1. Step 01

    IF lets a script make a decision from values saved by earlier commands. Its enclosed actions run only when the selected condition passes. Use it to choose a response, check a measurement, or react to a saved color. This overview explains OR, AND, XOR, and RGB Confidence without playing a demonstration.

    IF: Overview step 1: IF lets a script make a decision from values saved by earlier commands. Its enclosed actions run only when the selected condition passes. Use it to choose a response, check a measurement, or react to a saved color. This overview explains OR, AND, XOR, and RGB Confidence without playing a demonstration.
  2. Step 02

    Create a blank script for this option tour. The four mode tabs provide working examples with the supporting commands and visible results.

    IF: Overview step 2: Create a blank script for this option tour. The four mode tabs provide working examples with the supporting commands and visible results.
  3. Step 03

    Name the new script, then open its editor. We will inspect an IF block and cancel its draft changes when the tour is finished.

    IF: Overview step 3: Name the new script, then open its editor. We will inspect an IF block and cancel its draft changes when the tour is finished.
  4. Step 04

    Open Logic and drag IF OR into the script. Notice the matching End IF row. Put the commands that depend on the decision between these two boundaries.

    IF: Overview step 4: Open Logic and drag IF OR into the script. Notice the matching End IF row. Put the commands that depend on the decision between these two boundaries.
  5. Step 05

    When the IF passes, play continues through its enclosed commands. When it fails, that section is skipped. An optional ELSE section provides the alternative path. Keep ELSE between this IF and its matching End, and use no more than one ELSE in the same block.

    IF: Overview step 5: When the IF passes, play continues through its enclosed commands. When it fails, that section is skipped. An optional ELSE section provides the alternative path. Keep ELSE between this IF and its matching End, and use no more than one ELSE in the same block.
  6. Step 06

    In OR, AND, and XOR, each row compares a saved variable with a value. Variable Name identifies the value to read; Relationship chooses the comparison. Value can be a literal or a compatible earlier variable. Initialize your variables before the IF, and use the right types for the comparison.

    IF: Overview step 6: In OR, AND, and XOR, each row compares a saved variable with a value. Variable Name identifies the value to read; Relationship chooses the comparison. Value can be a literal or a compatible earlier variable. Initialize your variables before the IF, and use the right types for the comparison.
  7. Step 07

    The Relationship menu offers equal, not equal, greater than, greater than or equal, less than, and less than or equal. It also offers Between and Contains. Choose ordering comparisons for numeric or Time values, and use a comparison that makes sense for the variable's type.

    IF: Overview step 7: The Relationship menu offers equal, not equal, greater than, greater than or equal, less than, and less than or equal. It also offers Between and Contains. Choose ordering comparisons for numeric or Time values, and use a comparison that makes sense for the variable's type.
  8. Step 08

    Between adds a second value, labeled To. Both endpoints are included. For numbers, give the lower value first and the upper value second. A time-only interval can also cross midnight, such as a late-evening start and an early-morning end.

    IF: Overview step 8: Between adds a second value, labeled To. Both endpoints are included. For numbers, give the lower value first and the upper value second. A time-only interval can also cross midnight, such as a late-evening start and an early-morning end.
  9. Step 09

    Contains checks whether text includes the supplied text, without requiring a full match. In these IF comparisons, text matching ignores letter case. Equal compares the whole value instead. These comparisons do not have a confidence control; percentage matching belongs to RGB Confidence.

    IF: Overview step 9: Contains checks whether text includes the supplied text, without requiring a full match. In these IF comparisons, text matching ignores letter case. Equal compares the whole value instead. These comparisons do not have a confidence control; percentage matching belongs to RGB Confidence.
  10. Step 10

    Add Condition creates another comparison, up to five rows in one block. The small red X on a divider removes the row below it. Each row can use its own relationship. The selected IF mode decides how the row results combine; it does not change what each comparison means.

    IF: Overview step 10: Add Condition creates another comparison, up to five rows in one block. The small red X on a divider removes the row below it. Each row can use its own relationship. The selected IF mode decides how the row results combine; it does not change what each comparison means.
  11. Step 11

    OR passes when at least one condition is true. Other rows may be false. Use it when any of several acceptable situations should allow the same actions. The Mode button changes how the conditions combine, or switches to RGB Confidence.

    IF: Overview step 11: OR passes when at least one condition is true. Other rows may be false. Use it when any of several acceptable situations should allow the same actions. The Mode button changes how the conditions combine, or switches to RGB Confidence.
  12. Step 12

    AND passes only when every condition row is true. Use it when several requirements must all be met before continuing inside the block. One false row makes the combined decision false. The variable and relationship controls are otherwise the same.

    IF: Overview step 12: AND passes only when every condition row is true. Use it when several requirements must all be met before continuing inside the block. One false row makes the combined decision false. The variable and relationship controls are otherwise the same.
  13. Step 13

    XOR passes when exactly one condition row is true. With several rows, two true results do not pass. It is useful when one permitted situation must be present without another also being present. Choose OR instead if more than one true row should still be acceptable.

    IF: Overview step 13: XOR passes when exactly one condition row is true. With several rows, two true results do not pass. It is useful when one permitted situation must be present without another also being present. Choose OR instead if more than one true row should still be acceptable.
  14. Step 14

    RGB Confidence checks a saved Hex color against a target color. It does not capture the screen itself. Obtain the color earlier, for example with Pixel Find, then let this IF choose which commands run. This is a numeric color comparison, not artificial intelligence or image recognition.

    IF: Overview step 14: RGB Confidence checks a saved Hex color against a target color. It does not capture the screen itself. Obtain the color earlier, for example with Pixel Find, then let this IF choose which commands run. This is a numeric color comparison, not artificial intelligence or image recognition.
  15. Step 15

    Target Color is the color to compare against. It can be a hexadecimal color or a compatible earlier Hex variable. Hex Variable names the saved source color being checked. A color uses six hexadecimal digits, representing its red, green, and blue channels. Keep the source declared as Hex.

    IF: Overview step 15: Target Color is the color to compare against. It can be a hexadecimal color or a compatible earlier Hex variable. Hex Variable names the saved source color being checked. A color uses six hexadecimal digits, representing its red, green, and blue channels. Keep the source declared as Hex.
  16. Step 16

    Confidence accepts a whole-number percentage from one to one hundred. A higher percentage allows less variation; one hundred requires an exact RGB match. Lower values allow a larger difference in each color channel. Enter digits, not a variable, fraction, or percent sign. An empty field is an unfinished setup, not a passing condition.

    IF: Overview step 16: Confidence accepts a whole-number percentage from one to one hundred. A higher percentage allows less variation; one hundred requires an exact RGB match. Lower values allow a larger difference in each color channel. Enter digits, not a variable, fraction, or percent sign. An empty field is an unfinished setup, not a passing condition.
  17. Step 17

    Review the selected mode and all required values before using OK in a real script. This option tour uses the X to cancel without saving or playing. Choose the OR, AND, XOR, or RGB Confidence tab for a complete example of the decision and its visible result.

    IF: Overview step 17: Review the selected mode and all required values before using OK in a real script. This option tour uses the X to cancel without saving or playing. Choose the OR, AND, XOR, or RGB Confidence tab for a complete example of the decision and its visible result.