'---------------------------------------------------------------------- ' This macro was created by the macro recorder. ' Macro File: Office.ebs ' Date: Wed May 18 09:55:44 2016 ' Recorded for profile: WJ_Office '---------------------------------------------------------------------- Sub Main Dim HostExplorer as Object Dim MyHost as Object Dim Rc as Integer Dim iPSUpdateTimeout Dim iWaitForStringTimeout On Error goto GenericErrorHandler Set HostExplorer = CreateObject("HostExplorer") ' Initialize HostExplorer Object Set MyHost = HostExplorer.HostFromProfile("WJ_Office") ' Set object for the desired session If MyHost is Nothing Then Goto NoSession iPSUpdateTimeout = 60 ' WaitPSUpdated timeout set to 60 seconds iWaitForStringTimeout = 60 ' WaitForString timeout set to 60 seconds Rc = MyHost.WaitForString( "Username:", -1, iWaitForStringTimeout, TRUE ) If Rc = 0 Then Goto OnWaitForStringTimeout Rc = MyHost.Keys("shop_pc^M") Rc = MyHost.WaitPSUpdated( iPSUpdateTimeout, TRUE ) If Rc <> 0 Then Goto OnWaitPSUpdatedTimeout Rc = MyHost.WaitForString( "Do you have a barcode reader?", -1, iWaitForStringTimeout, TRUE ) If Rc = 0 Then Goto OnWaitForStringTimeout Exit Sub '-------------------- Runtime Error Handlers -------------------- GenericErrorHandler: Msgbox "Error " & Err & " : """ & Error(Err) & """ has occurred on line " & Erl-1 & "." & Chr(10) & "Unable to continue macro execution.", 16, "HostExplorer Basic Macro Error" Exit Sub NoSession: Msgbox "Profile ""WJ_Office"" is not running." & Chr(10) & "Unable to execute macro.", 16, "HostExplorer Macro Error" Exit Sub OnWaitPSUpdatedTimeout: Msgbox "Timeout occured waiting for host to update screen." & Chr(10) & "Unable to continue macro execution.", 16, "HostExplorer Basic Macro Error" Exit Sub OnWaitForStringTimeout: Msgbox "Timeout occured waiting for string on host screen." & Chr(10) & "Unable to continue macro execution.", 16, "HostExplorer Basic Macro Error" Exit Sub End Sub