← Back to team overview

sikuli-driver team mailing list archive

[Question #439204]: Capturing Text in Region with Mouse events

 

New question #439204 on Sikuli:
https://answers.launchpad.net/sikuli/+question/439204

I would like to share a solution that allows one to capture the text from a region using Mouse events. 

reg = selectRegion() # dynamically define region
hover(reg) # by default focus is on center point of region
mouseMove(-120, -20) #refocus to upper left of region, numbers depend on region size
mouseDown(Button.LEFT)
mouseMove(240, 40) # highlights entire region
mouseUp(Button.LEFT)
reg.type("c", KEY_CTRL) # copy highlighted text
value = Env.getClipboard() 
print str(value) # prints contents of region

There may a more elegant solution; but this is at least one solution!

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.