×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Control Attachmate with VB(A)

How do I use VB(A) to manipulate attachmate (6.5+)? by calculus
Posted: 26 Aug 03 (Edited 28 Mar 05)

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.

CODE

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:

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:

CODE

Set Sessions = Nothing
Set System = Nothing
Set Sess0 = Nothing
Set MyScn = Nothing

Hope you find this helpful.

Back to AttachMate solutions FAQ Index
Back to AttachMate solutions Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close