Example - Shell Function

  1. ' Calculator program included with Microsoft Windows; it then

    ' uses the SendKeys statement to send keystrokes to add some numbers.

    Sub Main ()

    1. Dim I, X, Msg          ' Declare variables.

      X = Shell("Calc.exe", 1)          ' Shell Calculator.

      For I = 1 To 5            ' Set up counting loop.

      1. SendKeys I & "{+}", True           ' Send keystrokes to Calculator

      Next I           ' to add each value of I.

      AppActivate "Calculator"           ' Return focus to Calculator.

      SendKeys "%{F4}", True           ' Alt+F4 to close Calculator.

    End Sub