Thumbnail

Get Line Containing From Array

by Synthiam

Adds a new ez-script function GetLineContainingFromArray() that will return an item from the array that contains the specified text.

Requires ARC v7 (Updated 11/1/2020) Source Code

How to add the Get Line Containing From Array robot skill

  1. Load the most recent release of ARC (Get ARC).
  2. Press the Project tab from the top menu bar in ARC.
  3. Press Add Robot Skill from the button ribbon bar in ARC.
  4. Choose the Scripting category tab.
  5. Press the Get Line Containing From Array icon to add the robot skill to your project.

Don't have a robot yet?

Follow the Getting Started Guide to build a robot and use the Get Line Containing From Array robot skill.


How to use the Get Line Containing From Array robot skill

This skill adds a new EZ-Script function GetLineContainingFromArray() that will return an item from the array that contains the specified text.

Main Window

User-inserted image

1. Start Button Once the Get Line Containing From Array Skill is loaded you will need a Script skill to access it's features. Once Get Line Containing From Array code is loaded into the Script skill use the Start button to activate it.

How to Use Get Line Containing From Array

  1. Add the Get Line Containing From Array Skill (Project -> Add Skill -> Scripting -> Get Line Containing From Array).

  2. Add the Script Skill (Project -> Add Skill -> Scripting -> Script).

  3. Enter code into the Script skill (see examples below) and click the Start Button.

Code Samples

The syntax of the function is:


GetLineContainingFromArray("$array", "Txt to search for")

An example is as such...


# Fill an array with the word "Banana" 20 times
defineArray($array, 20, "Banana")

# set the 5th index to these words
$array[5] = "Apple face"

# get the first line containing the text "apple"
$x = GetLineContainingFromArray("$array", "apple")

print("Found: " + $x + " Among the bananas")

Resources

You can download the source code here: GetLineContainingFromArray.zip


ARC Pro

Upgrade to ARC Pro

Harnessing the power of ARC Pro, your robot can be more than just a simple automated machine.

#9  

Good to hear. I'll be working on my (currently non existent) Javascripting skills soon.

Thanks for the info!!!