my dog learned polymorphism
The moose likes Java in General and the fly likes Can java send command to keyboard??? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Can java send command to keyboard???" Watch "Can java send command to keyboard???" New topic
Author

Can java send command to keyboard???

Shah Vishal
Ranch Hand

Joined: Feb 28, 2001
Posts: 32
Hi,
Is it possible using java, that from the code it presses any key from the keyboard. For an example,
Code presses A-Z,0-9 anything like that from keyboard.
Please help...
Thanks
Vishal Shah


-----<BR>SCJP2<BR>-----
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Are you actually trying to CREATE a KeyEvent, or only to duplicate the EFFECTS of a KeyEvent? Certainly you can Listen for the user to press a Key and then Turn THAT KeyEvent into something else.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Shah Vishal
Ranch Hand

Joined: Feb 28, 2001
Posts: 32
"Are you actually trying to CREATE a KeyEvent, or only to duplicate the EFFECTS of a KeyEvent? Certainly you can Listen for the user to press a Key and then Turn THAT KeyEvent into something else."
Actually what i want to do is that my java code sends the command and automatically particular alphabet is typed through the keyboard.
Thanks
Vishal Shah
Fred Abbot
Ranch Hand

Joined: Jun 01, 2000
Posts: 300
so based upon a command you want a certain letter to appear as if it was typed just write the corresponding letter to where evre it is going
why do you need the keyboard
Shah Vishal
Ranch Hand

Joined: Feb 28, 2001
Posts: 32
Hi,
Basically what i want to do is that, when you open a word document using exec() then i want to write in that word document through my java application, so that needs keypresses.
Thanks
Vishal Shah
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Why can't you just write to it like an output file?
One way or the other I am certain that you do NOT need KeyPresses, you just need data to get into that file. There is no need to get the HARDWEAR involved in that.
Ruslan Ivanov
Ranch Hand

Joined: Feb 22, 2001
Posts: 72
nope , that won't do it , You can't do it like that. I think you would need JNI to get this done. First you would need to get a handle to that Word window. THen locate the Document itself and then only write to it. I think this are the steps you have to take to do this.
Vin Man
Greenhorn

Joined: Jun 13, 2001
Posts: 26
Why can you open an output stream, write whatever you what, save it as a word doc, and open it as you have intended to? This way, you do not have to similate the typing after you open the document.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can java send command to keyboard???
 
Similar Threads
Detect AltGr key?
Stop Textfield from Going Blank
onscreen keyboard
Read out of focus key press
How to issue command in Java program