Can you wait for multiple targets and assign variable for the one that triggered?

Hi All,

  • Simple explanation of what I’m looking for
    Is there a ways to wait for multiple targets to become visible at the same time
    Then if one of the targets becomes visible assign it a variable so you can goto click code for that specific target?

  • Why
    it will be faster then looking for each button one by one. As one button may pop up while I’m looking for another in my current implementation. I also feel it will slim down and optimise my macro

  • My current implementation
    looping and ignoring errors
    wait for (button a) to be visible with 1sec timeout
    if true gotolabel click button a
    wait for (button b) to be visible with 1sec timeout
    if true gotolabel click button b
    wait for (button c) to be visible with 1sec timeout
    if true gotolabel click button c
    end

  • What I want to do
    Wait for (button a) or (button b) or (button c) to become visible 5min timeout
    (button b) found assign b to WhatButtonVariable
    gotoif WhatButtonVariable == b click button b

There may be a better way to do this I’m just looking to be pointed in the correct direction or informed on if my current way is the only way.

Currently UI Vision can only search for one image at once. But I think you can speed your code up by using visualSearch:

  • visualSearch | image1.png | i1
  • visualSearch | image2.png | i2
  • visualSearch | image3.png | i3
  • If_v2 | ${i1} > 0 || ${i2} > 0 || ${i3} > 0 … do something

|| means “or” in Javascript syntax. So the command checks if image1, 2 or 3 are found.

See also If {picture} then {do this}

thanks for the info I’m going to try this with sourcesearch. Are there any other tools like visualseach and sourcesearch that can output in a custom variable?