← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #268526]: detectng mouse in region

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Supposing you are using SikuliX 1.1.0:

chat.region.contains(Mouse.at())

would return true if the mousepointer at that moment is inside the given
region.

how to organise?

while True:
    if chat.region.contains(Mouse.at()):
        # do the chat stuff
    else:
        # do the game stuff

whenever you want to start over again use break in the code section,
which brings you back to <while True:>

... but I guess this will not solve your principal problem: the user
moves the mouse while your script is running, which is what you want to
detect.

The only possible solution currently is, to issue a 
popup("after clicking ok, you have 3 seconds to either move the mouse to the game or the chat area")
wait(3)

somewhere inside the loop.

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