ImageFound on a collection of Text Images


I have a string I am searching for in my test script. I want to search for it either selected or unselected. I was wondering if I could create a collection of text images based on the different text styles I need to support (regular, selected, etc) and then use imagefound on that collection, but I dont know how to code that. Any suggestions?

I do this a lot:

click ((text:"Something",textStyle:"UnselectedStyle"),(text:"Something",textStyle:"SelectedStyle"))

Remember the click command can take a collection (folder) or a list of images, or a list of Text Image property lists. Text is still an image as far as Eggplant is concerned. :wink:

Ah nice, thats cool. I write a function like this:

Params text

if imageFound( (Text:text, TextPlatform:"WindowsXP", TextStyle:"Default")) then
	return  (Text:text, TextPlatform:"WindowsXP", TextStyle:"Default")
	return (Text:text, TextPlatform:"WindowsXP", TextStyle:"Default_Selected")
end if

Click ImageFromText("text")

It does something similar…

You’d do this the same way that you’d search for multiple images, with a list of target images. Only in your case you’d use a list of text image property lists, like this:

if imageFound((Text:"Edit", TextPlatform:"MacOSX_10.5", TextStyle:"Menu"),(Text:"File", TextPlatform:"MacOSX_10.5", TextStyle:"Menu")) then
	//do stuff
end if

If you use the insert item on the script editor toolbar, you can easily add text image property lists to a command or function; that’s how I generated the example above.

Cool function. I like it.