1

I am going to research on which key typed most in which hour in a 24-hour-day? Later, I would research on which word used most in which hour in a 24-hour-day?

Say in the evening you would find most used word good or bye as people usually ends up their meeting in the evening.

So, I need to record keystrokes on the background using a java application with a time-stamp. My questions are:

  1. How to run a java program on the background?(Obviously informing the user).
  2. How to record keystrokes which are used in other applications and counted in the java application without affecting its original application?

Note that:

This question does not serve my problem. Though it has an accepted answer, but the answer is not helpful for me because it could not distinguish between uppercase and lowercase letter, it returns same ASCII character. It just gave some sources and some other files. I expect more readable answer and a clear view how the java program launch on the start up and run on the background.

Community
  • 1
  • 1
Enamul Hassan
  • 5,266
  • 23
  • 39
  • 56
  • 1
    You probably need to look at the [KeyListener](https://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html) class. – Chthonic Project Jul 14 '15 at 17:48
  • Maybe you should switch to C(++) an create hooks – user Jul 14 '15 at 17:50
  • sure, but KeyListener class works for working in the specific java application. Is there anyway to interact it with other OS dependent applications? @ChthonicProject – Enamul Hassan Jul 14 '15 at 18:01
  • 1
    If you looking for something that works as a keylogger across multiple applications, then Java is probably not the right way to go. It may be doable, but I doubt it will be a simple task. I'm afraid I don't have enough expertise to comment further in this direction. – Chthonic Project Jul 14 '15 at 18:05
  • possible duplicate of [Java key listener to track all keystrokes](http://stackoverflow.com/questions/12177416/java-key-listener-to-track-all-keystrokes) – Roman Vottner Jul 14 '15 at 18:12
  • I also think that java is not the right language for this work, but I am afraid of delaying the original work if I give more concentration on language. @ChthonicProject – Enamul Hassan Jul 14 '15 at 18:17
  • but I have no idea about C(++) hooks! @user – Enamul Hassan Jul 14 '15 at 18:19

1 Answers1

1

Just a little information to get you moving in the right direction. What you are looking to implement to listen for the keystrokes is KeyListener. I believe the actual function is keyTyped(ActionEvent e) but am not sure.

Other then that to run a program silently in the background will probably require some manipulation of the window + windows properties. You could just have the program run without a UI, or create a very lightweight UI that posts data. If you are looking for an actual "out of sight out of mind" background process, I am not sure how to do this with Java. However I imagine just an un-intrusive GUI would be sufficient for your purposes.

Sh4d0wsPlyr
  • 948
  • 12
  • 28