066e08b·Author: Tom Yeh·Closed by: Tom Yeh·2013-06-11
Description
I've added a method Keyboard.copy() which returns a String. This is the conceptual mirror of Keyboard.paste(String).
When copying, first the clipboard is cleared out, then the robot types the (modifier)-C key-combo, and finally we attempt to convert the clipboard contents to a string.
I've found this useful for cases where I want to read some text from a widget and I'm able to select and copy the text without much effort -- the text comes through cleanly with no need for OCR.
This pull request also includes two test classes and one test-helper class. I've tested this successfully on the following systems:
Mac OS X 10.8.2, Java 1.7.0_07-b10 (64-bit)
Windows 7, 64-bit, Java 1.7.0_13-b20 (64-bit)
Ubuntu 12.04.2 LTS, Java version 1.6.0_24 in OpenJDK 6b24-1.11.5-0ubuntu1~12.04.1
I've added a method
Keyboard.copy()
which returns aString
. This is the conceptual mirror ofKeyboard.paste(String)
.When copying, first the clipboard is cleared out, then the robot types the (modifier)-C key-combo, and finally we attempt to convert the clipboard contents to a string.
I've found this useful for cases where I want to read some text from a widget and I'm able to select and copy the text without much effort -- the text comes through cleanly with no need for OCR.
This pull request also includes two test classes and one test-helper class. I've tested this successfully on the following systems:
Mac OS X 10.8.2, Java 1.7.0_07-b10 (64-bit)
Windows 7, 64-bit, Java 1.7.0_13-b20 (64-bit)
Ubuntu 12.04.2 LTS, Java version 1.6.0_24 in OpenJDK 6b24-1.11.5-0ubuntu1~12.04.1