ScriptTap
ColorClassify

Command video guide

ColorClassify

ColorClassify turns stored Hex colors into useful codes or labels for later script decisions. It does not read the screen itself. This Intro demonstrates Single source / Rows targets.

Create and name a new blank script, then open the editor. If Android asks, allow screen capture. Manually drag SetVariable into it. Keep Single, choose Hex, and set h1=FF0000, the six-digit code for red. Keep This Script Only. A screen-reading command can supply the color in a real script; the fixed value makes this example predictable.

Under Advanced, drag ColorClassify after SetVariable and open its frame. Keep Source Mode Single and Source Hex h1: this input is a Hex variable, not a literal color. Array mode processes a declared Hex array segment. Use In keeps output local with This Script Only or shares it within the parent's call tree with Script Thread.

Set Confidence to 100 for an exact color match; lower values allow more RGB difference. The range is 1–100. Keep Output Type Integer, set Output i1, and No Match 0. Decimal supports fractional results and String supports labels. Every row Result and the No Match value must fit the selected type.

Keep Targets Rows. Set the first Color to FF0000, Result 1, optional Name Red. Use + for a second row: Color 0000FF, Result 2, Name Blue. Up to 16 rows are checked in order; the first matching color supplies its Result. Names are for readability, and a row's red X removes it. Hex Array instead looks up a declared target-color array. Tap OK.

Drag Display after ColorClassify. Keep Once, choose Variable i1, select a clear rectangle with the visual area selector, confirm the check mark, and set Lifespan 5000 ms. Leave appearance defaults unchanged and tap OK.

Drag PromptMe after Display. Keep the regular Standard prompt, Header Complete, and add a Done button with Boolean output b1. Keep Toggles & Text off. Tap OK, then close the editor.

Play the four-command script. The complete actual timed Display shows 1: red matched the first target and ColorClassify wrote its result to i1. Complete follows when Display closes. Press Done to finish automatically; natural completion leaves the permanent Play MainButton collapsed. The original h1=FF0000 remains unchanged.

Intro — Single / Rows

Step-by-step guide

  1. Step 01

    Color Classify turns a stored color into a useful number or label. Later commands can use that result to decide what to do. In this example, red will mean one and blue will mean two.

    ColorClassify step 1: Color Classify turns a stored color into a useful number or label. Later commands can use that result to decide what to do. In this example, red will mean one and blue will mean two.
  2. Step 02

    Open the main menu, then Scripts.

    ColorClassify step 2: Open the main menu, then Scripts.
  3. Step 03

    Create a new blank script.

    ColorClassify step 3: Create a new blank script.
  4. Step 04

    Find the new script at the bottom of the library.

    ColorClassify step 4: Find the new script at the bottom of the library.
  5. Step 05

    Open its options, choose Rename, and pick a descriptive name.

    ColorClassify step 5: Open its options, choose Rename, and pick a descriptive name.
  6. Step 06

    Select the script and open the editor. Collapse the extra overlay controls if needed. If Android asks, allow screen capture.

    ColorClassify step 6: Select the script and open the editor. Collapse the extra overlay controls if needed. If Android asks, allow screen capture.
  7. Step 07

    Expand Variables and drag Set Variable into the script. It will supply a known color for this example. Color Classify does not read the screen itself.

    ColorClassify step 7: Expand Variables and drag Set Variable into the script. It will supply a known color for this example. Color Classify does not read the screen itself.
  8. Step 08

    Open the added frame, keep Single mode, and choose Hex as the type.

    ColorClassify step 8: Open the added frame, keep Single mode, and choose Hex as the type.
  9. Step 09

    Name the variable h1 and enter the six-digit Hex code for red. Keep This Script Only and tap OK. A screen-reading command could supply this color in a real script.

    ColorClassify step 9: Name the variable h1 and enter the six-digit Hex code for red. Keep This Script Only and tap OK. A screen-reading command could supply this color in a real script.
  10. Step 10

    Find Color Classify under Advanced and drag it after the assignment. Then open its frame.

    ColorClassify step 10: Find Color Classify under Advanced and drag it after the assignment. Then open its frame.
  11. Step 11

    Keep Source Mode Single and enter h1 as Source Hex. This field takes a Hex variable, not a literal color. Array mode processes a declared Hex array segment. We will cover that workflow separately.

    ColorClassify step 11: Keep Source Mode Single and enter h1 as Source Hex. This field takes a Hex variable, not a literal color. Array mode processes a declared Hex array segment. We will cover that workflow separately.
  12. Step 12

    Use In selects where the result is stored. This Script Only keeps it local; Script Thread shares it within the parent's call tree. Keep the local scope here.

    ColorClassify step 12: Use In selects where the result is stored. This Script Only keeps it local; Script Thread shares it within the parent's call tree. Keep the local scope here.
  13. Step 13

    Set Confidence to one hundred for an exact color match. Lower values allow more difference between the source and target colors. The allowed range is one through one hundred.

    ColorClassify step 13: Set Confidence to one hundred for an exact color match. Lower values allow more difference between the source and target colors. The allowed range is one through one hundred.
  14. Step 14

    Choose Integer for numerical codes. Decimal is available for fractional values, and String for text labels. Each row's Result and the No Match value must match the selected output type.

    ColorClassify step 14: Choose Integer for numerical codes. Decimal is available for fractional values, and String for text labels. Each row's Result and the No Match value must match the selected output type.
  15. Step 15

    Set Output to i1. This variable receives the selected row's result. Set No Match to zero, which will be used if none of the target colors match.

    ColorClassify step 15: Set Output to i1. This variable receives the selected row's result. Set No Match to zero, which will be used if none of the target colors match.
  16. Step 16

    Keep Targets set to Rows to define the colors and their results here. Hex Array instead looks up colors stored in a declared array. We will cover that workflow separately.

    ColorClassify step 16: Keep Targets set to Rows to define the colors and their results here. Hex Array instead looks up colors stored in a declared array. We will cover that workflow separately.
  17. Step 17

    In the first row, enter red as the Color and one as the Result. Give it the optional name Red so the list is easier to read.

    ColorClassify step 17: In the first row, enter red as the Color and one as the Result. Give it the optional name Red so the list is easier to read.
  18. Step 18

    Use the plus button to add a second row. Enter blue as the Color, two as the Result, and name it Blue.

    ColorClassify step 18: Use the plus button to add a second row. Enter blue as the Color, two as the Result, and name it Blue.
  19. Step 19

    You can define up to sixteen target rows. They are checked in order, and the first color that matches supplies its Result. Names are for readability. The red X removes an unwanted row.

    ColorClassify step 19: You can define up to sixteen target rows. They are checked in order, and the first color that matches supplies its Result. Names are for readability. The red X removes an unwanted row.
  20. Step 20

    Tap OK. Set Variable provides red, then Color Classify converts that color to our numerical code. Next, add a visible result and a completion check.

    ColorClassify step 20: Tap OK. Set Variable provides red, then Color Classify converts that color to our numerical code. Next, add a visible result and a completion check.
  21. Step 21

    Expand Device and drag Display after Color Classify. This supporting command lets us see the value stored in i1.

    ColorClassify step 21: Expand Device and drag Display after Color Classify. This supporting command lets us see the value stored in i1.
  22. Step 22

    Open Display, keep Once mode, choose Variable as the source, and enter i1.

    ColorClassify step 22: Open Display, keep Once mode, choose Variable as the source, and enter i1.
  23. Step 23

    Open the area selector and resize the box to a clear area. Use the check mark to return.

    ColorClassify step 23: Open the area selector and resize the box to a clear area. Use the check mark to return.
  24. Step 24

    Set its lifespan to five thousand milliseconds, giving us five seconds to see the result. Keep the other settings at their defaults and tap OK.

    ColorClassify step 24: Set its lifespan to five thousand milliseconds, giving us five seconds to see the result. Keep the other settings at their defaults and tap OK.
  25. Step 25

    Drag Prompt Me after Display as a final confirmation. It shows that the script reached the next command.

    ColorClassify step 25: Drag Prompt Me after Display as a final confirmation. It shows that the script reached the next command.
  26. Step 26

    Keep the regular Standard prompt and give it the header Complete.

    ColorClassify step 26: Keep the regular Standard prompt and give it the header Complete.
  27. Step 27

    Add a button named Done, using b1 for its Boolean output. Then tap OK.

    ColorClassify step 27: Add a button named Done, using b1 for its Boolean output. Then tap OK.
  28. Step 28

    The four commands supply a Hex color, classify it, display the numerical result, and confirm completion. Close the editor.

    ColorClassify step 28: The four commands supply a Hex color, classify it, display the numerical result, and confirm completion. Close the editor.
  29. Step 29

    When the script is complete, simply use the Play button in the main overlay.

    ColorClassify step 29: When the script is complete, simply use the Play button in the main overlay.
  30. Step 30

    Display shows one. The red Hex value matched our first target.

    ColorClassify step 30: Display shows one. The red Hex value matched our first target.
  31. Step 31

    Complete confirms that the script reached Prompt Me. Later commands could use i1 to choose an action instead of repeatedly comparing Hex color codes.

    ColorClassify step 31: Complete confirms that the script reached Prompt Me. Later commands could use i1 to choose an action instead of repeatedly comparing Hex color codes.
  32. Step 32

    Press Done. The script finishes automatically. Use Color Classify when stored colors need meaningful codes or labels, with explicit targets and a clear No Match result.

    ColorClassify step 32: Press Done. The script finishes automatically. Use Color Classify when stored colors need meaningful codes or labels, with explicit targets and a clear No Match result.