Option Explicit
'you must have a reference set for Attachmate EXTRA! n.m Object Library
'runs with Form ufmPassword
Public oSystem As ExtraSystem
Public oSessions As ExtraSessions
Public oSess As ExtraSession
Public oScrn As ExtraScreen
Public vPassword
Public sCurrentScreenName As String
Sub IMS_Login(Optional bContinue As Boolean = False)
Dim result, bLogin As Boolean
Set oSystem = CreateObject("Extra.System")
If oSystem.Sessions.Count = 0 Then
[b][highlight #FCE94F]Set oSess = oSystem.Sessions.Open("C:\Program Files\E!PC\Sessions\Mainframe.edp[/highlight]")[/b]
' ufmPassword.Show
ufmPassword.Show
bLogin = True
Else
Set oSess = oSystem.ActiveSession
bLogin = False
End If
With oSess
.Visible = True
.WindowState = xNORMAL
End With
Set oScrn = oSess.Screen
If (oScrn Is Nothing) Then GoTo ExitMacro
oSystem.TimeoutValue = 100
With oScrn
If bLogin Then
' BHT SignOn
Do Until .WaitForCursor(17, 28)
DoEvents
Loop
.Area(17, 28, 17, 28) = "S"
.SendKeys ("<ENTER>")
' Login
Do Until .WaitForCursor(14, 37)
DoEvents
Loop
.Area(14, 37, 14, 46) = fOSUserName()
.Area(15, 37, 15, 46) = vPassword
.SendKeys ("<ENTER>")
' SuperSession
Do Until .WaitForCursor(9, 2)
DoEvents
Loop
.Area(11, 2, 11, 2) = "S"
.SendKeys ("<ENTER>")
' IMS Ready
End If
End With
'...Macro Magic happens here...
ExitMacro:
If bContinue Then Exit Sub
Set oScrn = Nothing
Set oSess = Nothing
Set oSystem = Nothing
End Sub