← Back to team overview

sikuli-driver team mailing list archive

[Bug 1275728] Re: [request] want to select randomly from a list of matches (e.g. findAll())

 

** Description changed:

+ *** workaround on the Python level (SikuliX script):
+ import random
+ click(random.choice(list(<some_region>.findAll((<some-image-or-pattern>)))))
+ 
+ ----------------------------------------------------------
+ 
  I need sikuli to choose randomly from its image recognition findings,
  how is that possible?
  
  My code in this case is:
  
   exists("autoSpectate.png",9999) # Wait for Spectate
   click("autoSpectate-1.png") # Click on Spectate
  
  There are normally a few "Spectate"s, but it mostly clicks on the same
  one.
  
   Is there a possiblility to make it randomized intentionally?
  
  Thanks!
  ---------------------------------------------------------------
  Seem to be a good idea to develop.
  Look at the question to find the actual workaround.

** Description changed:

  *** workaround on the Python level (SikuliX script):
  import random
- click(random.choice(list(<some_region>.findAll((<some-image-or-pattern>)))))
+ click(random.choice(list(<some_region>.findAll(<some-image-or-pattern>)))))
  
  ----------------------------------------------------------
  
  I need sikuli to choose randomly from its image recognition findings,
  how is that possible?
  
  My code in this case is:
  
   exists("autoSpectate.png",9999) # Wait for Spectate
   click("autoSpectate-1.png") # Click on Spectate
  
  There are normally a few "Spectate"s, but it mostly clicks on the same
  one.
  
   Is there a possiblility to make it randomized intentionally?
  
  Thanks!
  ---------------------------------------------------------------
  Seem to be a good idea to develop.
  Look at the question to find the actual workaround.

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1275728

Title:
  [request] want to select randomly from a list of matches (e.g.
  findAll())

Status in Sikuli:
  In Progress

Bug description:
  *** workaround on the Python level (SikuliX script):
  import random
  click(random.choice(list(<some_region>.findAll(<some-image-or-pattern>)))))

  ----------------------------------------------------------

  I need sikuli to choose randomly from its image recognition findings,
  how is that possible?

  My code in this case is:

   exists("autoSpectate.png",9999) # Wait for Spectate
   click("autoSpectate-1.png") # Click on Spectate

  There are normally a few "Spectate"s, but it mostly clicks on the same
  one.

   Is there a possiblility to make it randomized intentionally?

  Thanks!
  ---------------------------------------------------------------
  Seem to be a good idea to develop.
  Look at the question to find the actual workaround.

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1275728/+subscriptions


References