Fire the OS's Keyboard?

Does anyone know a way I can fire the keyboard listener for the OS so that it thinks I pressed a certain keyboard button but didn’t? Like for example I could write a Java program that press ‘A’ every 1 second, then if I go into TextEdit another ‘A’ will appear every second because it was fired in my OS, and therefore appears accross every app. Is there a way to do this? And if not in Java, does anyone know if any programs written which do?

java.awt.Robot?

Cool, didn’t know that existed. Put into memory bank :slight_smile:

Sweet I’ll give it a go and report my findings. Thanks.

Also check out java.awt.Toolkit to set the ‘lock’ key states like CAPS_LOCK, NUM_LOCK.

To do other native-OS-type things Runtime (for exec() ) & System also have some methods.

Keith

Robot works excellently on both Mac OS X and Windows XP. Thanks for the help. :smiley: