How to use ReadText?

How to use ReadText?

In the Reference Manual, it only has
Log ReadText(addressCoordinates)
Log ReadText(rectangel: addressCoordinates, multiLine: true)

I tried many ways, but never work.

For example,
Log ReadText((20,20), (50,50))
Log ReadText(30,30,30,30)
Log ReadText(rectangel: (20,20,20,20), multiLine: 3)
Log ReadText(“image1”, “image2”)

Could you give working real example for both?
Log ReadText(addressCoordinates)
Log ReadText(rectangel: addressCoordinates, multiLine: true)

You’re very close. The first parameter to ReadText() needs to be either a rectangle or a point, and the second (optional) parameter if given must be a property list of options. Three of your examples should work if you provide an additional pair of parentheses, as different ways of specifying rectangles:

Log ReadText(((20,20), (50,50))) 
Log ReadText((30,30,60,60))
Log ReadText(("image1", "image2"))

The other one could work like this:

Log ReadText((20,20,50,50), (contrast:yes))

You can also leave out one set of parentheses, because SenseTalk will automatically gather any named values at the end of a list of parameters into a property list. So this should also work:

Log ReadText((20,20,50,50), contrast: yes)

I think there were some small errors in the documentation, so we apologize for any confusion. Hopefully these examples will help.

To read text located at and around a point rather than the text within a specific rectangle, just use a point instead of a rectangle:

Log ReadText((35,35)) 
Log ReadText((45,45))
Log ReadText("image1") -- read text at the location of image1's hotSpot
Log ReadText((35,35), (multiLine: yes))

(Note: I changed a few of your parameters so they would represent rectangles with actual area – some of yours had zero size. Also, the multiLine option requires a boolean value, not a number. Oh, and the multiLine option is only relevant when reading text at a point, not within a rectangle, so I substituted ‘contrast’ in those cases to make a more realistic example.)

Thanks. I just tried:
Log ReadText(((20,20), (50,50)))
Log ReadText((30,30,60,60))
Log ReadText((20,20,50,50), (contrast:yes))
Log ReadText((20,20,50,50), contrast: yes)
Log ReadText((45,45))

It always returns errors:

10/7/11 12:53:29 PM START Running ReadText.script
10/7/11 12:53:31 PM FAILURE STMaxCallDepthExceeded Handlers were called to a depth exceeding the maximum limit (40). HINT: One common cause for this error is a script that has been given the same name as a built-in command or function unintentionally calling itself.
Execution Time 0:00:00 ReadText.script

Change the name of your script to something other than “ReadText”.

It works. I can get text now.
Actually it solves the same problem on naming issue in my another script.

If want to see what it’s seeing on my iPhone target… how do I use readText () to just tell me everything it sees on the iPhone target?

Could you give me an example?

Put ReadText (remotewindow)

??

You’re close:

put readText(remoteScreenRectangle())

Will put ALL of the text that it finds on the remote screen, but keep in mind that it’s likely to read some symbols as text of some sort, since you are asking it to.