views:

263

answers:

4

My goal is assign a global hotkey (JIntellitype, JXGrabKey) that would pass an arbitrary selected text to a java app.

The initial plan is to utilize the java.awt.Robot to emulate Ctrl-C keypress and then get the value from clipboard.

Probably there's a more elegant solution?

EXAMPLE: Open Notepad, type in some text, select that text. Now, that text needs to be copied into a Java app.

A: 

The reason you're not getting any answers is probably because your question is hard to understand the way you posed it. Could you give us a little more context and detail, please?

A: 

The Robot only sends events inside your JVM. I don't know of anything to send events out to the operating system. Though there is plenty of examples out there of making JNI calls to the windows API, it would then be platform specific.

Charlie
+1  A: 

I guess you want to implement a global input monitor, Java is not so straightforward to do the job. You may have to write an API hook and pack it in a DLL, then invoke it via JNI.

A: 

I've gone with with Robot and that works just fine.

alex