Image has no searchable pixels

Hi ,

  1. I use the following code .

Click (Text:“MiniTeam Name:”, TextFont:“Lucida Grande”, TextSize:“11”,Bold :“False”,Italic:“False”,SearchRectangle: (75,35),TextBackgroundColor:(0,0,0),TextColor:(0,0,0))

Used to Click On the Text “MiniTeam Name:” displayed on my screen, but when i ran the script iam getting following error

FAILURE Screen_Error.tiff Invalid Image Image has no searchable pixels.

Can Any one please let me know wht this issue is.

  1. also if i wanna click on a text box which is adjacent to my Text Label , Please let me know how to do this , by using Keywords rather than capturing it as an image file.

Thanks In Advance.

[quote=“User_Plant”]1) I use the following code .
Click (Text:“MiniTeam Name:”, TextFont:“Lucida Grande”, TextSize:“11”,Bold :“False”,Italic:“False”,SearchRectangle: (75,35),TextBackgroundColor:(0,0,0),TextColor:(0,0,0))

Used to Click On the Text “MiniTeam Name:” displayed on my screen, but when i ran the script iam getting following error

FAILURE Screen_Error.tiff Invalid Image Image has no searchable pixels.

Can Any one please let me know wht this issue is.[/quote]
I’m sure the Redstone guys have a better idea but I suspect the size of your search rectangle may be the problem. Try opening that up a little.

  1. also if i wanna click on a text box which is adjacent to my Text Label , Please let me know how to do this , by using Keywords rather than capturing it as an image file.

Add a hotspot property to this property list, and then your click command will click there instead of right on the text:

(Text:"MiniTeam Name:", 
TextFont:"Lucida Grande",
TextSize:"11",
Bold :"False",
Italic:"False",
SearchRectangle: (75,35),
TextBackgroundColor:(0,0,0),
TextColor:(0,0,0),
HotSpot:(x,y))

The Hot Spot is measured from the center of the image. Remeber that passing a Text property list like this to the Click command actually generates an image on the fly so all the things you can do to an image, you can do to text as well.

The problem that causes the “no searchable pixels” error is that the text color and text background color are the same. To generate a searchable text image, you must supply contrasting colors!

Allen is correct that there is also a problem with the SearchRectangle you’ve supplied. A rectangle must be specified as two points (a total of 4 values) indicating opposite corners (or sides, depending how you like to think of it) of the rectangle. You’ve only supplied a single point here.

Setting the HotSpot property, as Allen said, is the way to adjust where a click will occur relative to an image (including a generated text image). The HotSpot coordinates are relative to the top-left corner of the image, though, not the center. You could also get the location where an image is found (which by default would be the location of its center, since that’s where the HotSpot is normally located) and then calculate an offset from there.