In continuation with my previous blogs about Automation using PCSAPI and Automation using EHLLAPI API’s, this blog provides a brief about the strongest set of PCOMM API’s, the HACL (Host Access Class Library) API.
Host Access Class Library (HACL) is a set of objects that allows application programmers to access host applications easily and quickly. IBM Personal Communications supports different HACL Layers:
Automation Objects (Visual Basic, Word, Excel, etc):
The Host Access Class Library Automation Objects allow Personal Communications to support Microsoft COM-based automation technology (formerly known as OLE automation). The HACL Automation Objects are a series of automation servers that allow automation controllers, for example, Microsoft Visual Basic, to programmatically access Personal Communications’ data and features.
Note: Automation Objects provided by IBM Personal Communications are 32-bit in nature. These can be used only with 32-bit Microsoft Office programs.
At present, the following types of automation objects are supported.
• C++ objects:
This C++ class library presents a complete object-oriented abstraction of a host connection that includes:
• reading and writing the host presentation space (screen),
• enumerating the fields on the screen,
• reading the Operator Indicator Area (OIA) for status information,
• accessing and updating information about the visual emulator window,
• transferring files, and
• performing asynchronous notification of significant events.
• Java Objects:
Java objects provides Java wrappers for all HACL functions. Details on HACL Java classes will be covered in another blog in the near future.
• LotusScript Extension:
The Host Access Class Library LotusScript Extension (LSX) is a language extension module for LotusScript (the scripting and macro language of Lotus Notes and all the Lotus SmartSuite® products). This LSX gives users of Lotus products access to the HACL functions through easy-to-use scripting functions.
ECL Concept - Connections, Handles and Names
In the context of the ECL, a Connection is a single, and is unique to a Personal Communications emulator window.
Connections are distinguished by their connection handle or connection name. Most HACL objects are associated with a specific connection. Typically, the object takes a connection handle or connection name as a parameter on the constructor of the object. For example, to create an ECLPS (Presentation Space) object associated with connection 'B', the following code would be used:
PSObject = new ECLPS(’B’);
Set PSObject = CreateObject("PCOMM.autECLPS")
The HACL Automation Objects
Below is a graphical representation of most commonly used autECL Objects.
Several automation servers are implemented as real-world, intuitive objects with methods and properties that control Personal Communications operability. Each object begins with autECL, for automation Host Access Class Library. These objects and a brief description of each are as follows:
Essentially every class provides properties, methods and (optionally) Events with it. These can be used in conjunction or separately to interact with and control operations in PCOMM window.
More information about the mentioned Classes and sample code can be found in PCOMM online documentation.
Sample code below demonstrates usage of most common ECL objects and methods.
1. Object Declaration
2. Initialize session object by Handle or by Name
3. Sendkey (String, Row, Col)
' sends the text on mentioned row and col location
autECLPSObj.SendKeys "PCOMM API’s are very Powerful", 3, 1
4. Sendkey (KeyStroke)
' Send keystroke (Enter) on the green screen
5. GetText (Row, Col, Length)
' Gets the text of 10 bytes from row and col
PSText = GetText (1,1,10)
6. SetCursorPos (Row, Col)
' sets the cursor position at row and col location
autECLPSObj.SetCursorPos 2, 1
7. StartMacro (MacroName)
' Executes the PCOMM recorded .mac macro
8. WaitforInputReady (time in millsec)
' waits for specified number of milliseconds
' Number of rows and cols properties in green screen autECLPS class Object
Rows = autECLPSObj.NumRows
Cols = autECLPSObj.NumCols
10. GetCursorRow and GetCursorCol
' fetch rows and cols properties position
CurPosRow = autECLPSObj.CursorPosRow
CurPosCol = autECLPSObj.CursorPosCol
11. RegisterPSEvent/ RegisterCommEvent, RegisterKeyEvent
‘Refer the attached example Excel application
Download the sample code:
For further information on automation, and services offerings please email zServices@hcl.com or HCL-HI-LabServices@hcl.com.
Lead - Lab Services, IBM HACP & HATS