Use VBScript to open an application and perform actions in it

vbscript

Solution

The WshShell object is the solution.

- Use its `AppActivate()` method to bring any running application into the foreground.

- Use its `SendKeys()` method to send keystrokes to whatever application currently has the focus.

This is so simple that I omit sample code (you're almost there yourself, after all).

Problem

I've written the following vbs to open ciphergraph: ``` Dim objShell Set objShell = WScript.CreateObject( "WScript.Shell" ) objShell.Run("""C:\Program Files (x86)\CipherGraph\LaunchStub.exe""") Set objShell = Nothing WScript.Sleep 250 ``` I'd like to also select the 'Connect' button in the ciphergraph window - I can get to it by hitting 'TAB' twice and then 'RETURN' when the app launches how do I do this? Sorry if it's a basic question, new to VBS, but can't find an answer?? cheers

Original source