dragDrop not working reliably

Asked by dpel

dragDrop is not working consistently for me. I am using Sikuli r930 on a 64bit Windows7 PC.

I'm trying to capture the label of a checkbox in Sikuli. The function creates a list of all checkboxes on a screen (omitting specifc ones) then individually checks a single checkbox at a time and captures it's label (by selecting the label's text and copying it using type("c", KEY_CTRL)). The copying works perfectly as long as dragDrop selects the correct text. The problem is that the text selecting/highlighting only works the first few times (using the copy functions shown below). It checks the box (so I know it's the correct coordinates) but then highlights and copies the label of a different checkbox far to the right.

I notice as the program continues and starts misbehaving, when it selects (checks) a checkbox the mouse does not move to the point over the checkbox (as it did in the beginning when it properly highlighted the text). The mouse pointer was farther over to the right (as in 3.5 inches over, even though my debug print showed it was the right coordinates). It's as if the start point for the mouse was incorrect. hover(item.getCenter()) did not work either..... nor did using mouseMove(begin).

I tried applying a possible solution related to speed/mouse issues described in questions 133497 AND 148465 to no avail.

[133497 caused the mouse to initially drag upward and subsequently downward on the next execution]

The basic code that worked part of the time:

def copy(begin, end):
    dragDrop(begin, end)
    type("c", KEY_CTRL)

Then.....:

def copy(begin, end):
    mouseMove(begin); wait(0.7)
    mouseDown(Button.LEFT); wait(0.7)
    mouseMove(end); wait(0.8)
    mouseUp()
    type("c", KEY_CTRL)

(as well as those recommendations from 133497 AND 148465).

These are called using match or location objects.

Question information

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

I do not think, that the copy function as such is the problem (I would prefer the second solution, since it has more options to fine tune).

The problem must be the code before, that evaluates the begin and end for the function call copy(begin, end).

So check this again.

Can you help with this problem?

Provide an answer of your own, or ask dpel for more information if necessary.

To post a message you must log in.