← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #184730]: Create Region Button in IDE to code

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Simple example:

imgTop = "SikuliOvervi.png" # top left logo
mTop = find(imgTop)
rTop = mTop.left(1).right(700) # extending the matched region
rTop.highlight(2)

imgQInfo = "Questioninfo.png" # text header Question Information
mQInfo = rTop.below().find(imgQInfo) 
rQInfo = mQInfo.below(160) # defining a new Region
rQInfo.highlight(2)

# using the restricted region
imgOpen = "Open.png" #  open button
imgAnswered = "Answered.png" # answered button
if rQInfo.exists(imgAnswered, 0):
    print "Question still open"
elif rQInfo.exists(imgAnswered, 0):
    print "Question is answered"
else:
    print "something else happened to that Question"

This script works with this launchpad page open in Safari scrolled to the top and being frontmost behind Sikuli IDE.
Try it with Questions having different status's, to see the different printouts.

You can download the zipped .sikuli here: http://dl.dropbox.com/u/42895525/dfuller_example.sikuli.zip
(without the comments ;-)

Since it was made on a MacBook Air with Lion, It should run out of the
box.

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