• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Can java send command to keyboard???

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Shah Vishal
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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
 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
There are no more "hours", it's centi-days. They say it's better, but this tiny ad says it's stupid:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic