holding shift key in java

Asked by Jakub

Welcome again

  Could You help me with a current problem. Im going to use clipboard to get a string value from a field. But I cant get this value to a clipboard. It would be very kind of you if You could write some examples how to do it ( im using Sikuli from java). And also How do I know what is a key representation in string which is an argument of the KeyDown method ...

Most important thing is that I cant hold Shift. I use a _screen.keyDown("\ue020"); method but it just doesnt work

Thanks in advance
JAkub

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
Jakub (puav) said :
#1

Or maybe just have a shortcut Shift+ end on a keyboard ...

Revision history for this message
RaiMan (raimund-hocke) said :
#2

Ok, I'm just investigating it.

Meanwhile have a look at faq 1444 and try to use type() if possible.

If I understand right, you want to use the keyboard simulation to select text in some area of the screen. this should be possible with type() in text input fields/areas. In read only text areas (e.g. text parts in a web page) try doubleClick() in the upper left corner of the area and use the approriate type()'s to increase the selection.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

_screen.keyDown("\ue020");

should just do what it should: press and hold the shift key until a keyUp() is given.

So if you want to fire a Shift+end with KeyDown()/keyUp():

_screen.keyDown("\ue020");
_screen.keyDown("\ue007");
_screen.keyUp(null) // releases all held keys

but I think, KeyUp/KeyDown only make sense instead of type() if you have to press and hold keys during mouse actions or in very special situations (e.g. games).

Can you help with this problem?

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

To post a message you must log in.