Question

What I am trying to accomplish is to select an area on the screen with the mouse (outside of the may frame) and get the resulting region coordinates using Sikuli.

The code that should do this looks is below:

Screen screen = Screen.getPrimaryScreen();
Region region = screen.selectRegion("Select the area.");

What happens is that the cursor turns into a selector cross (the ones you usually see when you expect this function), but I can't select the area and actually the only way I can get back from the application is by killing it. Not too many examples I have found so I am asking for help here.

How can I make this work?

Also one other question:

I have downloaded the following script version:

Sikuli-IDE-1.0.0-Win64.zip

This means if I want to create a crossplatform solution I have to include like 6 jars? I have found a more universal Java API it seems (that is what it is called actually):

https://code.google.com/p/sikuli-api/

With all required supported OS but I can't find a single example on what I am trying to do that is similar to the little code snippet I pasted here. The sikuli script I am using now and this Sikuli API (apparently not the same) seems to be just different enough to amke this difficult.

Any suggestions? Thanks a lot in advance.

Was it helpful?

Solution

As it turns out, this only happens if I put this functionality on a Swing button's actionhandler. I have reported the bug to Sikuli and it will be probably fixed in the next release.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top