×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

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

I need to set this macro to run in a loop.

I need to set this macro to run in a loop.

I need to set this macro to run in a loop.

(OP)
Hello,

I need to set this simple macro to run in a loop indefinitely until I manually stop it.  Can someone edit this code so that I can just paste it right into the macro?  Basically, I want Pf1 to run once every few seconds, all day, no matter what the condition is.


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."
        STOP
    End If
    Set Sessions = System.Sessions

    If (Sessions is Nothing) Then
        Msgbox "Could not create the Sessions collection object.  Stopping macro playback."
        STOP
    End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
    g_HostSettleTime = 3000        ' 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."
        STOP
    End If
    If Not Sess0.Visible Then Sess0.Visible = TRUE
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
    
' This section of code contains the recorded events
    Sess0.Screen.Sendkeys("<Pf1>")    
    Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

    System.TimeoutValue = OldSystemTimeout
End Sub
 

RE: I need to set this macro to run in a loop.

Check out this thread. There may be a solution in it for you.

thread99-1402160: Keep Alive Timer

It's always better to ask stupid questions; stupid questions have been known to reduce the frequency of stupid mistakes. clown

RE: I need to set this macro to run in a loop.

This one too may be helpful, as well.

thread1-1552700: How do you Pause 3 seconds?

It's always better to ask stupid questions; stupid questions have been known to reduce the frequency of stupid mistakes. clown

RE: I need to set this macro to run in a loop.

(OP)
Thanks!   So far I'm not having any luck.  Either I get an error message that the macro cannot execute, or session just stops responding all-together.  As far as the screen refresh goes, that is exactly what I'm looking for.  The only difference is that my refresh is done by PF1 instead of ENTER.  

Any other ideas?

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