Option Explicit
Global psA As Object
Global psB As Object
Global psC As Object
Global psD As Object
Global psE As Object
Global psF As Object
Global OIAA As Object
Global OIAB As Object
Global OIAC As Object
Global OIAD As Object
Global OIAE As Object
Global OIAF As Object
Global E As String
Global C As String
Public Sub StartUp()
E = "[enter]"
C = "[clear]"
Set psA = CreateObject("PCOMM.autECLPS")
Set psB = CreateObject("PCOMM.autECLPS")
Set psC = CreateObject("PCOMM.autECLPS")
Set psD = CreateObject("PCOMM.autECLPS")
Set psE = CreateObject("PCOMM.autECLPS")
Set psF = CreateObject("PCOMM.autECLPS")
Set OIAA = CreateObject("PCOMM.autECLOIA")
Set OIAB = CreateObject("PCOMM.autECLOIA")
Set OIAC = CreateObject("PCOMM.autECLOIA")
Set OIAD = CreateObject("PCOMM.autECLOIA")
Set OIAE = CreateObject("PCOMM.autECLOIA")
Set OIAF = CreateObject("PCOMM.autECLOIA")
Connect
End Sub
Public Sub Connect()
psA.SetConnectionByName ("A")
psB.SetConnectionByName ("B")
psC.SetConnectionByName ("C")
psD.SetConnectionByName ("D")
psE.SetConnectionByName ("E")
psF.SetConnectionByName ("F")
OIAA.SetConnectionByName ("A")
OIAB.SetConnectionByName ("B")
OIAC.SetConnectionByName ("C")
OIAD.SetConnectionByName ("D")
OIAE.SetConnectionByName ("E")
OIAF.SetConnectionByName ("F")
End Sub
Public Function GetIt(PS As Object, Optional R As Long, Optional C As Long, Optional L As Long) As String
If R = 0 Then
GetIt = PS.GetText
Else:
GetIt = PS.GetText(R, C, L)
End If
End Function
Public Sub SendIt(PS As Object, Info As String, Optional R As Long, Optional C As Long)
'Public Sub SendIt(psName As String, PS As Object, Info As String, Optional R As Long, Optional C As Long)
Dim ErrorCount As Single
TryAgain:
Err() = 0
On Error GoTo MyModule_err
PS.SendKeys Info, R, C
'wait
Select Case PS.Name
Case "A"
Do Until OIAA.InputInhibited = 0
Loop
Case "B"
Do Until OIAB.InputInhibited = 0
Loop
Case "C"
Do Until OIAC.InputInhibited = 0
Loop
Case "D"
Do Until OIAD.InputInhibited = 0
Loop
Case "E"
Do Until OIAE.InputInhibited = 0
Loop
End Select
MyModule_err:
If Err() = -2147352567 Then
If ErrorCount < 2 Then
PS.SendKeys "[reset]", 0, 0
ErrorCount = ErrorCount + 1
Resume TryAgain
Else:
MsgBox "The emulator connection is locked" & Chr(13) & "Please check for the 'X <-8->' in the Op Info Area" & Chr(13) & "of emulator " & PS.Name & " and clear it"
'Quit_It
End If
End If
End Sub
Public Sub Enter(PS As Object)
'This will work to time by checking the upper left corner upper right corners to change
Dim lsUnTarget As String
lsUnTarget = GetIt(PS)
SendIt PS, E
Do Until GetIt(PS) <> lsUnTarget
DoEvents
Loop
End Sub[\code]
YOU WILL NEED TO call StartUp from your form load or Sub Main()
"Learn from others' mistakes. You could not live long enough to make them all yourself."
-- Hyman George Rickover (1900-86),