ScriptTap
ArrayGet

Command video guide

ArrayGet

ArrayGet reads one position from an array and copies its value into an output variable. Use it when a later command needs an item chosen by your script, without changing the original array.

This guide builds a short working example: declare Integer array a with three slots, set a2 to 7, and set Integer index i1 to 2. ArrayGet then reads a[i1] into i2. Display shows 7 for five seconds, and PromptMe provides a Done confirmation.

Choose Get on the shared ArrayGet/Set palette tile before dragging it into the script. The existing command row keeps its original Get or Set type. This video covers ArrayGet, the read operation.

Declare the array before reading it. Match its scope and Value Type: Integer, Decimal, Boolean, Hex, String, or Time. This Script Only is local; Script Thread shares variables within the calling script thread.

Positions start at 1. Index accepts a literal position or a previously set Integer variable. An unwritten, invalid, or incompatible read returns the selected type’s neutral value, such as zero or an empty String. Check the declaration, type, scope, and index if the result is unexpectedly empty.

Read an array value with ArrayGet

Step-by-step guide

  1. Step 01

    Array Get copies a value from a chosen array position into another variable. An array is a numbered collection of values. Using an Integer variable as the index lets your script choose which item to read.

    ArrayGet step 1: Array Get copies a value from a chosen array position into another variable. An array is a numbered collection of values. Using an Integer variable as the index lets your script choose which item to read.
  2. Step 02

    Create a new blank script.

    ArrayGet step 2: Create a new blank script.
  3. Step 03

    Open the new script's menu and choose Rename.

    ArrayGet step 3: Open the new script's menu and choose Rename.
  4. Step 04

    Give the script a clear name and save it.

    ArrayGet step 4: Give the script a clear name and save it.
  5. Step 05

    Select the new script, close the library, and open its editor.

    ArrayGet step 5: Select the new script, close the library, and open its editor.
  6. Step 06

    Under Variables, drag SetVariable into the live script and open its row. We first need an array for Array Get to read.

    ArrayGet step 6: Under Variables, drag SetVariable into the live script and open its row. We first need an array for Array Get to read.
  7. Step 07

    Switch to Array mode. This reserves a numbered group of slots rather than setting one variable.

    ArrayGet step 7: Switch to Array mode. This reserves a numbered group of slots rather than setting one variable.
  8. Step 08

    Keep Integer because this example stores whole numbers.

    ArrayGet step 8: Keep Integer because this example stores whole numbers.
  9. Step 09

    Use array letter a and capacity three. Its positions are a one, a two, and a three. The declaration must run before Array Get.

    ArrayGet step 9: Use array letter a and capacity three. Its positions are a one, a two, and a three. The declaration must run before Array Get.
  10. Step 10

    Drag in a second SetVariable command below the declaration and open it.

    ArrayGet step 10: Drag in a second SetVariable command below the declaration and open it.
  11. Step 11

    Keep Single mode with the Integer type.

    ArrayGet step 11: Keep Single mode with the Integer type.
  12. Step 12

    Set a two to seven. This fills the second array position with a value we can recognize later.

    ArrayGet step 12: Set a two to seven. This fills the second array position with a value we can recognize later.
  13. Step 13

    Save that command. These setup steps give Array Get a real value to retrieve.

    ArrayGet step 13: Save that command. These setup steps give Array Get a real value to retrieve.
  14. Step 14

    Add one more SetVariable command for the index.

    ArrayGet step 14: Add one more SetVariable command for the index.
  15. Step 15

    Choose Integer, set its name to i one, and give it value two. Changing this value would make Array Get read a different position.

    ArrayGet step 15: Choose Integer, set its name to i one, and give it value two. Changing this value would make Array Get read a different position.
  16. Step 16

    Under Advanced, the shared tile switches between Get for reading and Set for writing. Choose Get before dragging. An existing row keeps its original command type.

    ArrayGet step 16: Under Advanced, the shared tile switches between Get for reading and Set for writing. Choose Get before dragging. An existing row keeps its original command type.
  17. Step 17

    Now drag Array Get below the setup commands and open its new row.

    ArrayGet step 17: Now drag Array Get below the setup commands and open its new row.
  18. Step 18

    Match the array's scope. This Script Only is local. Script Thread shares variables within the calling script thread. We will keep This Script Only throughout this example.

    ArrayGet step 18: Match the array's scope. This Script Only is local. Script Thread shares variables within the calling script thread. We will keep This Script Only throughout this example.
  19. Step 19

    Set Array Letter to a. Enter only the family letter here, not a numbered slot name.

    ArrayGet step 19: Set Array Letter to a. Enter only the family letter here, not a numbered slot name.
  20. Step 20

    Value Type must match the declared array. Integer, Decimal, Boolean, Hex, String, and Time are available. Keep Integer for this number array.

    ArrayGet step 20: Value Type must match the declared array. Integer, Decimal, Boolean, Hex, String, and Time are available. Keep Integer for this number array.
  21. Step 21

    Set Index to i one. Array Get uses its current Integer value, two, so this execution reads a two. You can also enter a literal position directly.

    ArrayGet step 21: Set Index to i one. Array Get uses its current Integer value, two, so this execution reads a two. You can also enter a literal position directly.
  22. Step 22

    Set Output to i two. The retrieved number is copied there; reading does not remove or change the original array value.

    ArrayGet step 22: Set Output to i two. The retrieved number is copied there; reading does not remove or change the original array value.
  23. Step 23

    Positions start at one. An unwritten, invalid, or incompatible read returns the selected type's neutral value, such as zero or an empty String. Check the array, type, and index if a result is unexpectedly empty.

    ArrayGet step 23: Positions start at one. An unwritten, invalid, or incompatible read returns the selected type's neutral value, such as zero or an empty String. Check the array, type, and index if a result is unexpectedly empty.
  24. Step 24

    Save Array Get.

    ArrayGet step 24: Save Array Get.
  25. Step 25

    Drag Display below Array Get and open it. This supporting command makes the retrieved number visible.

    ArrayGet step 25: Drag Display below Array Get and open it. This supporting command makes the retrieved number visible.
  26. Step 26

    Keep Once, choose Variable, and set i two as the source.

    ArrayGet step 26: Keep Once, choose Variable, and set i two as the source.
  27. Step 27

    Open the area's coordinate editor. Set the top left to one hundred, three hundred, and the bottom right to four hundred forty, six hundred. This defines where the result appears.

    ArrayGet step 27: Open the area's coordinate editor. Set the top left to one hundred, three hundred, and the bottom right to four hundred forty, six hundred. This defines where the result appears.
  28. Step 28

    Set Lifespan to five thousand milliseconds, or five seconds, then save. Display will show the number before the script continues.

    ArrayGet step 28: Set Lifespan to five thousand milliseconds, or five seconds, then save. Display will show the number before the script continues.
  29. Step 29

    Finally, drag PromptMe below Display and open it. This gives us a clear confirmation at the end.

    ArrayGet step 29: Finally, drag PromptMe below Display and open it. This gives us a clear confirmation at the end.
  30. Step 30

    Keep Standard mode and use Complete as the header.

    ArrayGet step 30: Keep Standard mode and use Complete as the header.
  31. Step 31

    Add a Done button with Boolean output b one, then save. The button lets us confirm the result and finish the script.

    ArrayGet step 31: Add a Done button with Boolean output b one, then save. The button lets us confirm the result and finish the script.
  32. Step 32

    The first three commands prepare the array, value, and index. Array Get performs the read. Display shows the number, and PromptMe confirms completion.

    ArrayGet step 32: The first three commands prepare the array, value, and index. Array Get performs the read. Display shows the number, and PromptMe confirms completion.
  33. Step 33

    Close the editor and expand the main overlay.

    ArrayGet step 33: Close the editor and expand the main overlay.
  34. Step 34

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

    ArrayGet step 34: When the script is complete, simply use the Play button in the main overlay.
  35. Step 35

    Display shows seven, the value from position two.

    ArrayGet step 35: Display shows seven, the value from position two.
  36. Step 36

    After five seconds, the confirmation appears. Choose Done to finish.

    ArrayGet step 36: After five seconds, the confirmation appears. Choose Done to finish.
  37. Step 37

    The script finishes automatically after confirmation. Use Array Get whenever later commands need a value from a position chosen by your script.

    ArrayGet step 37: The script finishes automatically after confirmation. Use Array Get whenever later commands need a value from a position chosen by your script.