Archive for November, 2010

Java SE Robot class to the rescue

I work in a firm where they are control freaks. I was giving a computer system without admin rights, I can’t install, I can’t download etc). The system in question has some freaky really hard password rules, so my password is complicated to a tee. But those are not annoying. The annoying thing is I am forced to work on my personal system, and upload to this desktop to test stuffs. The problem is whenever I don’t use the system for about 5 mins, it starts the screen saver and when I want to use it, I have to enter that crazily long and difficult password. Also I have emails coming into the system, when the screen saver is showing I don’t have any way to know if I got a new mail or not, thus I have missed some important mails. Well all that was happening until today; I remembered the Robot class.

The Robot class in J2SE can do some cool stuffs like move the mouse, click it, type some key combinations etc (I remember freaking someone out back then when I used the Robot class to pop up windows is shutting down message every 5 mins). Anyway I noticed that all you need to do is move the mouse, scroll the wheel or type a key and the screensaver won’t show. I wrote a Java program that scroll the mouse wheel one point every four minutes. The program runs in the background, windows visibility is false and it runs in an eternal loop. I put an icon in the task bar that allows me to kill the app whenever I want to close.

Now life is beautiful, I don’t miss emails anymore, I don’t have to type that long and very hard to type password more than once in a day and the only thing left for me to do make the app start automatically when I log in. I don’t have access to some folders in the system so that will be a bit of work. But for now, I am happy to just open it once a day if it will save me loads and loads of headache and typing. Here is the javadoc for Robot class Robot

Comments (2)