Send keys/commands to other applications
It is easy to send keys or phrases to an application using Visual Basic. For this example, create a new project and create a command button. Start WordPad and go back to VB. Insert all of the code into the click() event of the command button. We now want to send some keys or a phrase to WordPad. All there is to do is to activate the wordpad window:

AppActivate "WordPad"

And then just send the phrase:

SendKeys "This is a test."

You can also send commands and special keys:

SendKeys "%{F4}"
This command sends the "Alt + F4" command and Wordpad. Wordpad will then ask if you would like to save. Now just send the "n" key:

SendKeys "n"

The Visual Basic help describes in detail how to use theese two commands and contains a listing of codes for special keys like "{BACKSPACE} {BREAK} {ENTER}".


Go back to my vb-page