2

I'm trying to send a few simple keys to a DirectX 11 game after a certain picture is shown on screen.

Problem is the proper keys isn't being sent through the robot class, VK_UP simply isn't being sent.

My thought was to send through directinput instead and just hope it works, but I don't know how to do this in Java?

Re-write in C# isn't an option since I'm using sikuli for Java for image recognition.

Kmonassar
  • 91
  • 7
  • 1
    Have you tried http://www.hardcode.de/jxinput/? It seems it implement Microsoft DirectInput – André Apr 20 '15 at 19:09
  • From what I've understood JXInput is only for implementing support for gaming devices in your Java application? Or am I wrong? – Kmonassar Apr 20 '15 at 19:14

2 Answers2

2

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

Keyboard keyboard = new Keyboard();
keyboard.winKeyPress(ScanCode.DIK_UP);
//Thread.sleep(1000);
keyboard.winKeyRelease(ScanCode.DIK_UP);
Umer Farooq
  • 762
  • 1
  • 8
  • 17
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.

Tenzin
  • 2,415
  • 2
  • 23
  • 36
  • Enter is working just fine, but VK_UP(arrow up) does nothing. Works fine in notepad but not at all in game, just enter. – Kmonassar Apr 20 '15 at 20:15
  • Maybe you are looking for: keyUp(), or type(Key.UP) – Tenzin Apr 20 '15 at 20:37
  • I'm using the Java sikuli library, not sikuli script. Sorry if I wasn't clear about that. Can't get it to work with the link you sent me in Java. I tried kb.keyDown(Key.UP); to no avail. Where kb = new desktopkeyboard(); – Kmonassar Apr 20 '15 at 21:02