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
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
posted
0
"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
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
posted
0
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
posted
0
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.
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.
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.