2 Eylül 2011 Cuma

JAVA Robot Class

Nowadays, it's spectacularly popular to control something remotely. However Java Robot class isn't a new and cutting edge technology but you can do fantastic thing if you know how to use it.

Today, we are gonna build a very small app that will launch Notepad and types the text that we want.

Step 1 : let's open a new notepad file :

Runtime.getRuntime().exec("notepad.exe");

Step 2 : now type the keys:

Robot r=new Robot();
r.keyPress(KeyEvent.VK_T);


Actually that is just it but we can do some funny things. For instance lets add a waiting time so it will seem as if we are in Hollywood movies :)

Thread.sleep(500);

You can download pure and poor codes from right here :)


We will add a few extra features in near future, stay tuned and have fun..

Hiç yorum yok: