Re: [Sikuli-driver] [Question #402262]: Random number of times around a loop

2016-09-27 Thread alan carr
Question #402262 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/402262

Status: Open => Solved

alan carr confirmed that the question is solved:
Thanks Raiman / Roman I have resolved with your help

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #402262]: Random number of times around a loop

2016-09-27 Thread Roman Podolyan
Question #402262 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/402262

Roman Podolyan posted a new comment:
import random
random.seed()

for i in range(10):
xtimes = random.randint(1, 5)
print xtimes
for x in range(xtimes):
print "x"
print "x loop is over\n" 


In output you are going to see random number of printed "x", something
like this:

1
x
x loop is over

3
x
x
x
x loop is over

4
x
x
x
x
x loop is over

1
x
x loop is over

1
x
x loop is over

5
x
x
x
x
x
x loop is over

3
x
x
x
x loop is over

5
x
x
x
x
x
x loop is over

4
x
x
x
x
x loop is over

4
x
x
x
x
x loop is over

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #402262]: Random number of times around a loop

2016-09-26 Thread alan carr
Question #402262 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/402262

Status: Answered => Open

alan carr is still having a problem:
I have read the python docs however I am no developer, I thought I was
close to this, any more help much appreciated

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


Re: [Sikuli-driver] [Question #402262]: Random number of times around a loop

2016-09-25 Thread RaiMan
Question #402262 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/402262

Status: Open => Answered

RaiMan proposed the following answer:
--- random:
see: https://docs.python.org/2/library/random.html

--- wait for image x OR y
while true:
if exists(image1, 0):
# do something
break
if exists(image2, 0):
# do something
break
wait(1)

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp


[Sikuli-driver] [Question #402262]: Random number of times around a loop

2016-09-25 Thread alan carr
New question #402262 on Sikuli:
https://answers.launchpad.net/sikuli/+question/402262

I am trying to create  a loop that "loops" a random number of times between x 
and y

I tried the following -:

import random
random.seed()
t=random.randint(1, 5)

while True:

for x in range(t):


### Loop ###
click("__CLICK-TO-CAPTURE__")

Loop


I can get things to work if for "x in range(5) " which will create a 5 x loops 
but I require a random number of loops.


One additional point is there a way of creating a wait for image  x OR y to 
appear 


-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.

___
Mailing list: https://launchpad.net/~sikuli-driver
Post to : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp