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!

*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

Attachmate Macro

Attachmate Macro

Attachmate Macro

I am looking for help in creating an Attachmate Macro that will Trap a typed command that closes the entire program after the Macro Finishes running.  Can this be done or am I just dreaming?  

Example Open program macro runs necessary operations and finishes.  Person performs necessary steps and type "OFF" to close the session.  That is when I want to have the program close without the user intervention.  Thanks for the advise.

RE: Attachmate Macro


Let's see what code you have developed so far.


glassesJust traded in my old subtlety...
for a NUANCE!tongue

RE: Attachmate Macro

Well that is where the problem lies.  I need to know if that will work or not first.  But here is what I have thought of.  Please don't laugh at my hacking as I am not working with any real knowledge here just piecing this together.   I have included comments where I am looking at inserting the DIM object.  I really should get a VB book and really learn how to program.
' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$

Sub Main()
' Get the main system object
    Dim Sessions As Object
    Dim System As Object
    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."
    End If
    Set Sessions = System.Sessions

    If (Sessions is Nothing) Then
        Msgbox "Could not create the Sessions collection object.  Stopping macro playback."
    End If

' Set the default wait timeout value
    g_HostSettleTime = 3000        ' milliseconds
        g_MenuSettleTime = 1000        ' milliseconds
    OldSystemTimeout& = System.TimeoutValue
    If (g_HostSettleTime > OldSystemTimeout) Then
        System.TimeoutValue = g_HostSettleTime
    End If

' Get the necessary Session Object
    Dim Sess0 As Object
    Set Sess0 = System.ActiveSession
    If (Sess0 is Nothing) Then
        Msgbox "Could not create the Session object.  Stopping macro playback."
    End If
    If Not Sess0.Visible Then Sess0.Visible = TRUE
' This section of code contains the recorded events

    System.TimeoutValue = OldSystemTimeout

' Minimize Attachmate
   SendKeys("% ")

' This is my insertion of the code I need for the wait
'I have no idea how to tie this in
  Dim w1 as Object
  Dim waits as Object
  ' Get a Waits collection object
  Set waits = System.Waits
  ' Trap for Function Key (Exit Macro)
  Set w1 = Sess0.Screen.WaitForKeys(off)
'not sure how to tie the below in to set as a

End Sub

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

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