Opens a conversation with the BlueZone Display session. The Connect command must be called before any other BlueZone Host Automation Object methods that access data in the host screen.
Connect will auto-connect to the BlueZone session that launched the BlueZone Object or it will search for the first available session if launched from BlueZone desktop when no short name session identifier is specified.
Parameters:
SessionShortName - Uniquely identifies the BlueZone Display session. The Session Name corresponds to the HLLAPI Short Name Session Identifier configured in the Options:API settings in the BlueZone Display emulator. See Example 1.
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 will auto-determine session name. See Example 2.
[Blank] - If the Session Name parameter is omitted completely, the BZHAO will connect to the session that is running in the foreground. If no session is running in the foreground, then the first session found is used.
ConnectRetryTimeout - Optional - Used to set the time in seconds that Connect will spend attempting to connect to the BlueZone session. Also, as an option, a zero (0) can be used to cause the Connect to abort if the first attempt fails. See Example 3.
Returns:
0 for success; or a non-zero error code. See Error Codes for a complete listing of error code descriptions.
Remarks:
The script may only be connected to one display session at a time. When connecting to multiple sessions, any previously connected session is automatically disconnected.
Example 1:
Set Host = CreateObject( "BZWhll.WhllObj" )
UserId = "John"
Password = "Smith"
ResultCode = Host.Connect( "A" )
If ( ResultCode = 0 ) Then
Host.WriteScreen Userid, 5, 63
Host.WriteScreen Password, 6, 63
Host.SendKey "@E"
Host.WaitReady 10, 1
End If
Example 2:
Dim host, SessionName, SessionId
Sub LoginToHost
Set Host = CreateObject( "BZWhll.WhllObj" )
Host.SetBrowserWnd window.top
Host.ConnectToHost 2, 0 'zero means BZHAO must auto-determine session id
Host.Connect "!" '! means BZHAO must auto-determine session name
SessionName = Host.GetSessionName()
SessionId = Host.GetSessionId()
Host.addConnectionCallback 2, SessionId, "ConnectionCallback"
'additional login statements
Host.Disconnect 'break link with session when done
End Sub
Sub ConnectionCallback
Host.Connect SessionName 'connect to the same session
'additional logoff statements
Host.Disconnect
End Sub
Example 3:
Set Host = CreateObject( "BZWhll.WhllObj" )
UserId = "John"
Password = "Smith"
ResultCode = Host.Connect( "A", 5 ) 'try to connect for 5 seconds
If ( ResultCode = 0 ) Then
Host.WriteScreen Userid, 5, 63
Host.WriteScreen Password, 6, 63
Host.SendKey "@E"
Host.WaitReady 10, 1
End If