← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #189706]: copy text from a GUI textbox field

 

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

RaiMan posted a new comment:
*** revised because of some typo

If this should happen, while the user is still working on the GUI, this
will be very tricky to solve or not possible at all.

Why? Main reason: Because you will need the mouse and keyboard to
accomplish the task:

click(theEntryField)
wait(0.5)
type("a", KeyModifier.CTRL) # select all text
wait(0.5)
type("c", KeyModifier.CTRL) # copy to clipboard
wait(0.5)
text = Env.getClipboard()

during this piece of code, the user should not use keyboard and mouse.
Depending on wether the wait()s are needed with your GUI, the whole
action might take 1 to 3 seconds.

--- The second problem to solve: wait, until the user has finished entering text into the field.
Since Sikuli has no features, to act with the GUI as such, it has to be solved, by watching the visual situation of the field or (if it is guaranteed, that the user does not use the keyboard to go to next field) or by tracking the mouse movement.

visual:
use a change observer, that waits for the user to start changing the visual content of the field and then wait until he does not do it anymore. (tricky, but scriptable)

mouse movement:
wait until the mouse enters the field and then wait until the mouse leaves it again. (scriptable but risky, since the user might accidentally move the mouse away before finishing text entry)

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