Sending Colon Commands to the Application

Colon commands can be sent to the application using the ConsoleModel object. A example of the use of this command is shown in the following example:

Public Sub TransmitColonCommand(ColonCommand As String)
      Dim i As Integer
      Dim objConsoleModel as Object
      
      ’Create a new/get existing ConsoleModel reference
      Set objConsoleModel = mvarConnection.getconsole()

      objConsoleModel.docommand (coloncommand)
      LastLineOutputPage2 = objConsoleModel.getlastoutputline

      ’Got an answer ?
      Do
            objConsoleModel.pollcommandresponses
            i = i + 1
            DoEvents
            Loop Until (i > 32000) Or _
                  (objConsoleModel.getlastoutputline <> LastLineOutputPage2)

            ’Show the answer
            If LastLineOutputPage2 <> objConsoleModel.getlastoutputline Then
                  i = LastLineNrPage2 + 1

                  Do
                        MsgBox (objConsoleModel.getoutputline(i))
                        i = i + 1
                  Loop Until (objConsoleModel.getoutputline(i) = _
                              objConsoleModel.getlastoutputline())
            End If
End Sub

Note: You have to poll the command responses. This is necessary because it is programmatically impossible to know when any particular command has finished sending all of its data, for example, running a Report.