Drag and Drop auto-selecting X, y of each point while performing action

Asked by Mat

Hello,

Is there any way that I can use drag and drop in a way that will do the following:

1- On click it registers the x, y location
2- Drag to a seperate location, but the action is performed on the screen as I drag
3- Register the x, y for the drop when mouse is released

I am basically testing a 3D model and need to manipulate the object, but it is quite difficult and time consuming to do trial by error as I need pretty exact movements.

I am completely new to Sikuli, having been trying eggPlant before this. So far I am impressed! Would totally be sold on this for sure if there is an extension that will allow me to do this, or if anyone knows how.

Thanks for any help you can give me!

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Mat
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

not really clear what you mean (already read through the docs, to get a feeling about Sikuli?)

dragDrop(Location(x,y), Location(x1, y1))

will drag from (x,y) and drop at (x1,y1) using the predefined waiting times (after click to drag and before final drop).

The above Locations can be evaluated before using the various other features of Sikuli like finding images and manipulating regions on the screen.

Revision history for this message
Mat (mathieu-cormier) said :
#2

Hi RaiMan,

Thanks for the response. I went through the documentation and saw the DragDrop (Location (x,y), Location (x1,y1)), but we need to input the x, y values manually, and in my case, we don't see the final location of the 3D model until we run the script.

I was hoping there might be an extension that would allow the x,y and x1,y1 values to be captured automatically as we performed the drag and drop on the 3D model. This would ensure that the model is positioned exactly the way we want it, and capture the points for the script at the same time.

At the moment we have Sikuli installed on a closed network, so I am unable to access the extensions to see what is available. I am hoping to be able to get it on a machine that has access to the internet soon, but looking for answers in the meantime.

Thank you again for your help!

Revision history for this message
RaiMan (raimund-hocke) said :
#3

--- extensions ...
nothing available at the moment

--- understood your challenge now (hope so;-)
The solution might be a script, that defines a hotkey, that you press, when the mouse position is ready.
Then in the hotkey handler you can get the mouse location via Env.getMouseLocation().

so you could start the script, let it wait for the hotkey being pressed, move the mouse manually to the desired location and press the hotkey.

This is the principle.

Another option to show Locations to a Sikuli script (synchronously in this case) is to use selectRegion("move mouse to position and click right"). This would bring up the capture prompt, you move the mouse to the position and click right (which just aborts the capture). internally you again use Env.getMouseLocation(), to get the currentLocation.
This is a bit more dangerous, than the first version (but much easier to script;-), since you might move the mouse slightly, when pressing the right Button. Alternatively you could try ESC to cancel the capture after mouse positioning.

Revision history for this message
Mat (mathieu-cormier) said :
#4

Once again, thank you very much for your help, I will look into your suggestions. Much appreciated!