While using Attachmate's built in macro language is very convenient, it is sometimes more efficient to use VB or VBA (Excel) to manipulate the system. The following code shows how to initiate the objects in VB. Once the objects are created, the coding is exactly the same as in Attachmate's Extra! Basic language. [This applies to version 6.5 or greater only]
Simply use the code snipet below to create the objects and off you go. Don't forget that these objects will need to exists in each module you want to talk to Extra.
Public Sessions As Object Public System As Object Public Sess0 As Object
'Extra Objects Set System = CreateObject("EXTRA.System") ' Gets the system object If (System Is Nothing) Then MsgBox "Could not create the EXTRA System object. Stopping macro playback.": Stop Set Sessions = System.Sessions If (Sessions Is Nothing) Then: MsgBox "Could not create the Sessions collection object. Stopping macro playback.": Stop Set Sess0 = System.ActiveSession If (Sess0 Is Nothing) Then MsgBox "Could not create the Session object. Stopping macro playback.": Stop
...Macro Magic happens here...
Set Sessions = Nothing Set System = Nothing Set Sess0 = Nothing
For even more functionality, add a reference (VBA - Tools>References; VB - Project>References) to Attachmate Object Library, then use this code:
Public System As ExtraSystem Public Sessions As ExtraSessions Public Sess0 As ExtraSession Public MyScn As ExtraScreen
Set System = New ExtraSystem Set Sessions = System.Sessions Set Sess0 = System.ActiveSession Set MyScn = Sess0.Screen
Now you can refer to the "MyScn" object and you'll have a drop down box of all the available properties and methods.
Don't forget to unbind these objects at the end of your code:
Set Sessions = Nothing Set System = Nothing Set Sess0 = Nothing Set MyScn = Nothing