Establishes a link between the BlueZone Host Automation object and the BlueZone Display session. Connect must be called before any other BlueZone Host Automation object methods that access data in the host screen.
As an option, when the BlueZone session is embedded, using an exclamation point (!) can be used in place of an actual SessionShortName. When ! is used, the BZHAO auto-determines the session name. See Example 2 below.
Set bzhao = CreateObject( "BZWhll.WhllObj" ) UserId = "John" Password = "Smith" ResultCode = bzhao.Connect( "A" ) If ( ResultCode = 0 ) Then bzhao.WriteScreen Userid, 5, 63 bzhao.WriteScreen Password, 6, 63 bzhao.SendKey "<Enter>" bzhao.WaitReady 10, 1 End If
Dim host, SessionName, SessionId Sub LoginToHost Set bzhao = CreateObject( "BZWhll.WhllObj" ) bzhao.SetBrowserWnd window.top bzhao.ConnectToHost 2, 0 'zero means BZHAO must auto-determine session id bzhao.Connect "!" '! means BZHAO must auto-determine session name SessionName = bzhao.GetSessionName() SessionId = bzhao.GetSessionId() bzhao.addConnectionCallback 2, SessionId, "ConnectionCallback" 'additional login statements bzhao.Disconnect 'break link with session when done End Sub Sub ConnectionCallback bzhao.Connect SessionName 'connect to the same session 'additional logoff statements bzhao.Disconnect End Sub
Set bzhao = CreateObject( "BZWhll.WhllObj" ) UserId = "John" Password = "Smith" ResultCode = bzhao.Connect( "A", 5 ) 'try to connect for 5 seconds If ( ResultCode = 0 ) Then bzhao.WriteScreen Userid, 5, 63 bzhao.WriteScreen Password, 6, 63 bzhao.SendKey "<Enter>" bzhao.WaitReady 10, 1 End If