1

在屏幕上显示特定图片后,我正在尝试向 DirectX 11 游戏发送一些简单的键。

问题是没有通过机器人类发送正确的密钥,根本没有发送 VK_UP。

我的想法是通过直接输入发送,只是希望它有效,但我不知道如何在 Java 中做到这一点?

用 C# 重写不是一个选项,因为我使用 sikuli for Java 进行图像识别。

4

2 回答 2

1

试试https://github.com/umer0586/winKeyboard

Keyboard keyboard = new Keyboard();
keyboard.winKeyPress(ScanCode.DIK_UP);
//Thread.sleep(1000);
keyboard.winKeyRelease(ScanCode.DIK_UP);
于 2018-01-23T15:14:08.617 回答
0

What kind of key combination are you looking for?
Here is a link about keys in Sikuli: Link

For example: Ctrl + x

type('x', KeyModifier.CTRL)

Arrow up:

App.focus("Notepad")
type(Key.UP)

I did use App.focus() in my example to make sure Sikuli is focusing on Notepad before clicking anything.

于 2015-04-20T20:07:25.007 回答