Trying to select text with mouse functions

Asked by Maurice Richard on 2019-09-19

Originally I tried using OCR, but it's not as consistent as I need it to be.
So I'm trying to select a section of text on the page with mouse functions.

I've tried many variations, but I always get the same error:
"Invalid combination of button flags"

Here's a current snippet of the code:
    regTheText = Region(XText, YText, XTextLength, YTextLength )
    leftPoint = regTheText.getTopLeft()
    rightPoint = regTheText.getBottomRight()
    hover(leftPoint)
    mouseDown(Button.LEFT)
    wait(0.5)
    mouseMove(rightPoint)
    mouseUp(Button.LEFT)

It doesn't seem to like the mouseDown command.
Is my code incorrect? Or do I need to import something specific?

Any help is appreciated.

Thanks!
Maurice

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2019-09-19
Last query:
2019-09-19
Last reply:
2019-09-19
Best RaiMan (raimund-hocke) said : #1

this works for me with latest 1.1.4 on Windows 10:
switchApp("Edge")
r = selectRegion()
hover(r.getTopLeft())
mouseDown(Button.LEFT)
wait(0.3)
mouseMove(r.getBottomRight())
mouseUp()
type("c", Key.CTRL)
wait(0.5)
print App.getClipboard()
click()

Maurice Richard (flashfires) said : #2

Thank-you RaiMan, this worked for me.
It's much appreciated!

Maurice Richard (flashfires) said : #3

Thanks RaiMan, that solved my question.