Sending keyboard input or clicks to external programs.

Is it possible?

Page 1 of 1

4 Replies - 576 Views - Last Post: 26 June 2010 - 05:23 PM Rate Topic: -----

#1 deemeetar   User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 66
  • Joined: 22-January 10

Sending keyboard input or clicks to external programs.

Posted 26 June 2010 - 04:23 PM

Hello guys,
i want to create an application that will have some shortcuts that will send to some applications(simulate keyboard or mouse input).

For example i would want this program to capture what i write and then send data to the application that has the foucs.

For example if i have that application in background and i write !hi, i want the application to write: Hello there. Whats up?

I think you get my point.
Where to get started about this?(i have enough knowlage to understand a code that has been written or something like that :D)

This post has been edited by deemeetar: 26 June 2010 - 04:24 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Sending keyboard input or clicks to external programs.

#2 bcranger   User is offline

  • D.I.C Lover
  • member icon

Reputation: 253
  • View blog
  • Posts: 1,199
  • Joined: 01-February 10

Re: Sending keyboard input or clicks to external programs.

Posted 26 June 2010 - 04:38 PM

Try looking at the Robot class as it allows you to send Mouse and Key events via computer i.e. automatically without human input.

As for your program, do you mean something like an auto typer? And also, I believe you will need to have your Java program in focus for you to type "!hi" then click your other program to get the message in that program. You could use native code, JNI, to help you make a program that takes input in the background, I believe.
Was This Post Helpful? 0
  • +
  • -

#3 Matamane   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 111
  • Joined: 12-August 09

Re: Sending keyboard input or clicks to external programs.

Posted 26 June 2010 - 04:45 PM

Depending on how it works, have you considered working with the Scanner class? When I was doing my first Java exercises, we were told to set this up to read inputted numbers or strings and to give appropriate output based on that.

You could also try something with sequences of KeyEvents.
Was This Post Helpful? 0
  • +
  • -

#4 deemeetar   User is offline

  • D.I.C Head

Reputation: -2
  • View blog
  • Posts: 66
  • Joined: 22-January 10

Re: Sending keyboard input or clicks to external programs.

Posted 26 June 2010 - 04:59 PM

I will pay a look at the robot class.
I think if i find a java keylogger i can get some general idea.
Was This Post Helpful? -1
  • +
  • -

#5 KYA   User is offline

  • Wubba lubba dub dub!
  • member icon

Reputation: 3213
  • View blog
  • Posts: 19,241
  • Joined: 14-September 07

Re: Sending keyboard input or clicks to external programs.

Posted 26 June 2010 - 05:23 PM

Keyloggers, while not always malicious, fall under a group of software/programs that we here at Dream.In.Code do not assist with. It is a violation of the site's TOS. Closed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1