Gathering and Using Data
Reading Text on the SUT
The ReadText() and ReadTable() functions use the Eggplant Functional (EPF) OCR engine to read and return the text in a given area on the SUT. The area can be within a rectangle (determined by two diagonal points), or near a single point.
For simplicity, the following information refers to the ReadText() function. This information applies to the ReadTable() function as well.
Reading text within a rectangle
When you call the ReadText() function with a rectangle parameter, the rectangle absolutely limits the returned text value. That is, if a line of text extends beyond the edges of the text rectangle, the overflow text is not returned.
Like other rectangles in Eggplant Functional, the text rectangle is determined by two diagonal points. Each point can be given as an image name (which represents the location where that image is found) or any other coordinate value.
Example:
Set address to ReadText (("AddressField", "EndAddressField"))
// Sets the address variable to the text in the given rectangle. The diagonal points of
// the rectangle are the location of the AddressField image, the location of the
// EndAddressField image.
Reading text near a point
When you call the ReadText() function with a single point parameter, the OCR engine attempts to find a line of text that includes your point, or a line of text that begins near that point.
The point can be given as an image name (which represents the location where that image is found) or any other coordinate value.
Using the SUT clipboard
If the text you want to read can be selected and copied, copy the text to the SUT clipboard, then return the clipboard contents through the RemoteClipboard() function.
Example:
Click "SomeTextField"
TypeText CommandKey, "a" // Selects All in the text field.
TypeText CommandKey, "c" // Copies text to the clipboard.
put RemoteClipboard(5) // Waits up to 5 seconds to return the clipboard content generated by previous remote command; shows that content.