Results 1 to 4 of 4
  1. #1
    gump74 is offline Member
    Join Date
    Mar 2013
    Posts
    7
    Rep Power
    0

    Default Record keyboard and mouse events system wide for input to robot

    Greetings All,
    I am looking for help with writing a program that will have output to feed the AWT robot. I already have MouseInfo working though it has too much output I can just check to see if it changes. The part that I have not been able to find is recording the system wide keyboard events, i.e. when the java program is on active and something else has focus. I have tried searching the net for this and very few forums have answered questions. the most promising was;
    Java Code:
    Scanner Input = new Scanner(System.in);
    this did work when the java program had focus it did not work if I was typing in another program. Does anyone have any ideas?

  2. #2
    jim829 is online now Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,620
    Rep Power
    5

    Default Re: Record keyboard and mouse events system wide for input to robot

    This has been asked many times before in this forum. You cannot intercept keyboard events typed into other applications. That is a form of spyware.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: Record keyboard and mouse events system wide for input to robot

    Quote Originally Posted by jim829 View Post
    You cannot intercept keyboard events typed into other applications.
    ... using Java. Its an OS specific thing, you need native code and a good knowledge of the OS's programming API to be able to pull it off.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  4. #4
    jim829 is online now Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,620
    Rep Power
    5

    Default Re: Record keyboard and mouse events system wide for input to robot

    Of course. But I assumed the OP was talking about Java.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

Similar Threads

  1. Replies: 0
    Last Post: 12-06-2012, 09:21 AM
  2. Keyboard Events?
    By dharav in forum New To Java
    Replies: 1
    Last Post: 01-14-2012, 03:16 AM
  3. Question on Java Graphics, KeyBoard Events and JFrame
    By loopsnhoops in forum New To Java
    Replies: 1
    Last Post: 02-10-2011, 03:12 AM
  4. Replies: 10
    Last Post: 10-14-2010, 01:33 AM
  5. Help with keyboard events?
    By Bibendum in forum New To Java
    Replies: 2
    Last Post: 11-02-2007, 02:51 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •