This chapter presented the Robot project, a powerful program that can run any other program by remote control. If you want to perform repetitious tasks, the Robot is for you. If you want to schedule tasks to be performed late at night, the Robot is for you, too.

You enter commands for the Robot in a text area or in a command file. Each command is of the form operation:data, where operation is one charactereither t (text), m (move mouse), c (click), r (right-click), w (wait), s (screen shot), or b (beep).

You first start the program you want to control, then start the Robot. Enter the commands you want to use to control the target program and then click Go. The Robot will disappear, giving the focus back to the target program, and the Robot will send your commands to that program.

Using the t command, the Robot can send text to the program it's controlling. You can send test strings to the other program, and you can press the Alt key (good for giving you access to the menu system in Windows) or the Ctrl key and then release it. You can also send Tab, Enter, and Esc keys.

For that matter, you can also use the mouse to control the other program. You can use the m command to move the mouse to where you want it via screen coordinates. You can left-click the mouse with the c command, and you can right-click the mouse with the r command.

You can make the Robot wait using the w command, passing it the number of seconds to wait. For example, w:60 makes the Robot wait for 60 seconds.

You can also make the Robot take screenshots for youyou just have to pass it the s command. When the Robot takes a screenshot for you, it stores the result as a PNG file in cap.png.

And finally, you can make the Robot beep using the b command. Beeps serve as notifications that the Robot has woken up after a delay and is active again.

The Robot is both powerful and useful; all you have to do is to start it up, tell it what to do, and let it do its thinng.

    Java After Hours(c) 10 Projects You'll Never Do at Work
    Java After Hours: 10 Projects Youll Never Do at Work
    ISBN: 0672327473
    EAN: 2147483647
    Year: 2006
    Pages: 128

    Similar book on Amazon © 2008-2017.
    If you may any questions please contact us: