'----------------------------------------------------------------------
' This macro was created by the macro recorder.
' Macro File: mmcs.ebs
' Date: Tue Jun 04 08:56:51 2013
' Recorded for profile: mmcs
'----------------------------------------------------------------------

Sub Main
  Dim HostExplorer as Object
  Dim MyHost as Object
  Dim iIdleTime

  Dim iPSUpdateTime

  On Error goto ErrorCheck

  Set HostExplorer = CreateObject("HostExplorer") ' Initialize HostExplorer Object
  Set MyHost = HostExplorer.HostFromProfile("mmcs") ' Set object for the desired session

  iPSUpdateTime = 60   ' PS Update wait time set to 60 seconds
  iIdleTime = 2000     ' Idle time set to 2000 milliseconds

  MyHost.WaitPSUpdated(iPSUpdateTime)
  Rc = MyHost.WaitForString("Username:", -1, 9999, TRUE)
  MyHost.Keys("mmcswj^M")
  MyHost.WaitPSUpdated(iPSUpdateTime)
  Rc = MyHost.WaitForString("|                            Badge    :                                        |", -1, 9999, TRUE)
  Exit Sub

ErrorCheck:
  if (Err = 440) Then
    Msgbox "The specified session is not running.", 16, "Hummingbird Macro Error"
  End If
  Exit Sub
End Sub
