5

I am having trouble using drag and drop with Sikuli. I would like to drag something in any other direction (up, down, left, right) for a fixed number of pixels.

This looks like it should work:

t = find("1325249963143.png")
dragDrop(t, [t.x + 100, t.y + 100])

Sikuli IDE log says

[log] DRAG (741,525) to null

but the element is not dragged.

This works just fine:

dragDrop("1325249963143.png", "1325251471990.png")

The log says

[log] DRAG (741,525) to (507,490)

What am I doing wrong?

Environment: Mac OS X 10.7.2, Sikuli X-1.0rc3 (r905)

Željko Filipin
  • 56,372
  • 28
  • 94
  • 125

3 Answers3

13

only to say hello here - an alternative coding:

dragDrop(t, t.offset(Location(100, 100)))
Liron Yahdav
  • 10,152
  • 8
  • 68
  • 104
RaiMan
  • 1,088
  • 8
  • 13
9

To quote RaiMan (raimund-hocke):

the first parameter is a Match object, which is ok. the second prameter must be of type PSMRL too (see docs: Pattern/Image, String, Match, Region or Location)

dragDrop(t, Location(t.x + 100, t.y + 100))
Željko Filipin
  • 56,372
  • 28
  • 94
  • 125
0

I use this code to drag an image down to a given location:

image1 = ("image1.png")
imageLoc = find(image1)
dragDrop(imageLoc, Location(imageLoc.getX() + 100, imageLoc.getY() + 100))
Tenzin
  • 2,415
  • 2
  • 23
  • 36