Search for multiple text styles

I’m looking for a convenient way to “group” text styles. I have three different text styles I need to look for. Each style contains at least different color sets, to be able to find the text no matter if the text is unselected, selected or marked. In this case, I do not need to know in which state (style) the text is, I just need to know if it is on screen at all…

Currently, I’m creating something like this:

WaitFor 10,(
(Text:“Zzongg”, TextStyle:“C_Unselected”),
(Text:“Zzongg”, TextStyle:“C_Selected”),
(Text:“Zzongg”, TextStyle:“C_Marked”))

Creating something like this once might be ok, but if you need to do this 100 times, this becomes quite nasty and error prone.

Any suggestions?

Thx,
Andre

anvoi–

Try placing them in a list:

put ((Text:"Zzongg", TextStyle:"C_Unselected"),(Text:"Zzongg", TextStyle:"C_Selected"), (Text:"Zzongg", TextStyle:"C_Marked")) into style_list 

Now you can say:

waitFor 10, style_list

You could also wrap this in a handler:

to wait_for_styles
    WaitFor 10,( 
    (Text:"Zzongg", TextStyle:"C_Unselected"), 
    (Text:"Zzongg", TextStyle:"C_Selected"), 
    (Text:"Zzongg", TextStyle:"C_Marked")) 
end wait_for_styles

then it’s an even shorter 1-liner:

wait_for_styles

Hope this helps

Yes, this helps!

Thanks,
Andre :smiley:

Andre–

You can DRY this out further by passing your wait time and list as parameters, letting you re-use this over and over with different lists:

to wait_for_styles_superdeluxe wait_time, style_list
    WaitFor wait_time, style_list
end wait_for_styles_superdeluxe

Thanks a lot, Allen!

Can I keep it as simple, if I want to pass the text as parameter instead? Or (as I would need to remove it from the style_list) do I need to take a different approach?

Cheers,
Andre

You surely can indeedy use multiple text definitions in most of the Eggplant commands. Since the *Any Eggplant command (waitforany, etc) are depreciated with use of lists for the same non-any commands. See the release notes for 4.x. I might suggest reading from top to bottom the release notes for Eggplant, they are chocked full of good simple explanations and also tell of some best use at the same time.