Click to See Complete Forum and Search --> : Running other Programs using VB


leviv
07-17-2006, 09:15 PM
Hi all,

I am trying to automate a program by using a single button. The program I am opening is called Blast, which I have no problem opening using VB. But once it opens I want it to automatically select the site I want to connect to and then have it connect to the site all with a single click of a button.
Any Ideas would be Great!

Thanks,
Levi

Andrew Cushen
07-20-2006, 09:43 PM
There are basically 2 options here:

1) See if the program you are trying to automate has an API you can call - check the program's website and/or e-mail the company/author

2) Use a kludge like SendKeys() - look it up in the online help - which will send keystrokes to the other program's window. I call it a kludge because there are a lot of things that can go wrong with this method; there are too many things you can't control about the other program. If the program is only for your own use, this may work fine.

I believe there is also a Win32 API call that can do the same thing as SendKeys(), but I can't recall its name at the moment.

HTH,

-Andrew

edburdo
07-21-2006, 02:06 PM
If you don't mind spending some money, you can go buy Winbatch. It is available from http://www.winbatch.com/ and it is great for automating other programs.

Otherwise, you have the two options already mentioned. And I have to agree with Andrew. Sendkeys doesn't always work as expected. It is too easy to intercept the commands and the wrong window picks them up.