← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #143761]: Whether dragDrop() can use more than once in a same script

 

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

    Status: Open => Needs information

RaiMan requested for more information:
what system? Win, Mac, Linux?

which version of Sikuli? (recommendation: use Sikuli X)

what app are you dragging in?

Can it be, that your app does not recognize the second mouse-down-and-
hold on the same object after the first dragDrop (normally the focus
after that is on the target region). You may need an intervening click()
somewhere, where nothing happens, to get into a the same situation as
before the first dragDrop (see my example at the end).

--- General comments on your script
-- The region you are dragging from is always the same in all 3 cases
-- The wait() after r = Region() is not needed

optimized script:

r = Region(200,12,23,34)

# case 1
d=Region(400,34,54,56)
dragDrop(r,d)
wait(1) # usually 1 second wait after mouse action is sufficient

# case 2
d1=Region(300,43,54,65)
dragDrop(r,d1)
wait(1)

# case 3
d2=Region(254,43,76,32)
drag(r)
wait(1)
dropAt(d2)
wait(1)

With Sikuli X on Mac the following script worked for me with the
standard settings:

It copies the same desktop icon (a file) to 3 different locations below
- one after the other.

click(Location(0,25)) # deselect all (neutral click)
m = find(a-desktop-icon) # this is your r Region
for x in (100, 200, 300):
	z = m.below(x) # this is your d Region
	click(Location(0,25)) # deselect
	keyDown(Key.ALT) # want to copy
	dragDrop(m,z)
	keyUp()

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