← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #167430]: Middle Mouse Click

 

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

obiwan-92 posted a new comment:
Hello,
If you need to do a middle click, copy this in a sikuli file and import it at the beginning of your script.
You can use it with nothing, a region or a screen (including the SCREEN varaible).
For example Screen(2).middleClick("img.png")
Regards.

## Middle Click ##
class Region(Region):
    def middleClick(self, psmrl):
        try:
            psmrl = self.find(psmrl).getTarget()
        except:
            pass
        hover(psmrl)
        mouseDown(Button.MIDDLE)
        mouseUp(Button.MIDDLE)
        print "[log] MIDDLE CLICK on", psmrl
class Screen(Screen):
    def middleClick(self, psmrl):
        Region(self.getBounds()).middleClick(psmrl)
def middleClick(psmrl):
    SCREEN.middleClick(psmrl)
SCREEN = Screen(0)

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