← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #218789]: User selected images

 

Question #218789 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/218789

    Status: Open => Answered

RaiMan proposed the following answer:
if the click location is fixed during the script run:

reg1 = selectRegion("show me the next location to click later on") #
interactive region select

later on

click(reg1) # this clicks the center of reg1

if you need to search the visual object later on, because it might have
moved or was a sample:

img1 = capture("show me the next image to click later on")

and later

click(img1)

If you want to be flexible:

regs = []
regs.append( selectRegion("show me the next location to click later on") ) 
... and more of them

now regs contains all selected regions.

to access one of them:
click( regs[4] )

and 
len(regs)

is the number of selected regions.

to print them all:

for reg in regs:
    print reg

or 
for n in range( len(regs) ):
    print "region", n, "is", regs[n]

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.