如何使用Sikuli Java Standalone jar键入特殊键?

时间:2013-04-08 03:33:33

标签: java sikuli

Sikuli X我可以使用类似

的内容
type("x", KEY_CTRL)

我如何在Sikuli API中执行相同操作?

3 个答案:

答案 0 :(得分:1)

我用这种方式在我的项目中使用:

Screen screen = new Screen();

screen.click(<your texbox>); // click into textbox to have a cursor there

screen.type("a", KeyModifier.CTRL); // this sends Ctrl+"a" to select all text <- this is what you asked for !
screen.type(Key.BACKSPACE); // this sends Backspace key pressed, i.e. here deletes all selected text

请注意,我同时使用了KeyModifier和Key。这样就有用了。

答案 1 :(得分:1)

试试这个,

Screen screen = new Screen();
screen.type("x",Key.CTRL)
screen.type("\n");

答案 2 :(得分:0)

使用KeyEvent中的密钥代码:

DesktopKeyboard keyboard = new DesktopKeyboard();
keyboard.keyDown(KeyEvent.VK_CONTROL);
keyboard.type("x");
keyboard.keyUp(KeyEvent.VK_CONTROL);