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 auto-connects to the BlueZone session that launched the BlueZone Object or it searches 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 settings in the BlueZone Display emulator. See Example 1 below.
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.
[Blank]
If the SessionShortName parameter is omitted completely, the BZHAO connects 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 spends 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 below.
Returns
0 for success; or a non-zero error code. Refer to
Error codes for a complete listing of error code descriptions.
Remarks
The script can 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