Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

diff b/w WaitHostQuiet vs OIA.XStatus

Status
Not open for further replies.

Mayhem79

Programmer
Jun 5, 2003
2
0
0
AU
Hiya,

I've recently been investigating the functions and objects available in Attachmate Extra! and was unable to find any information on the following subject.

I want to know the repercussions of changing our WaitHostQuiet calls to checking the status of the XClock instead.

My understanding of the WaitHostQuiet call is that it will wait for a specific amount of time until after the last receipt of data from the host and then return.

I'm hoping to speed thing up by checking the status of the XClock and returning when it is no longer present - ie that all the data on the screen has been updated.

Has anyone done this previously or know of any reason why it should/shouldn't work? Any information would be greatly appreciated.

Thanks,
Mayhem79.
 
In my experience, Attachmate meant the WaitHostQuiet to be exactly what you're looking for. Problem is that it doesn't function the way the docs say it does. It actually works the same as a pause statement.

Do determine if the screen data is refreshed, I typically use the WaitForString method and find something on the screen to be sure it's finished doing what I want it to.

If you find a function to check the X-clock, I'd love to know about it.
 

Here's the current VBA function I have to wait until the Xclock is clear - it's very very basic and if the terminal is locked will wait indefinitely. This is the inital sub I came up with which led to my post:

Public Function My_Wait_Host_Quiet() As Boolean

Dim nClockStatus As Integer

Sleep (50)

'get clock status - anything but zero means clock is up
nClockStatus = MyOIA.XStatus

Do Until (nClockStatus = 0)
Sleep (50)
nClockStatus = MyOIA.XStatus
Loop

My_Wait_Host_Quiet = True

End Function

Other functions which may be of interest:
MyOIA.XStatus -> XClock value

MyOIA.ErrorStatus -> Error value (can be used to tell if terminal is locked)

MyOIA.Value -> the entire status bar from the bottom of the screen as a string


 
I've wondered the same thing and tested XStatus heavily. It is far more efficient than WaitHostQuiet and any other Wait function. I'm stuck with 6.4 and I've noticed that a running macro always uses 100% of the processor. Adding DoEvents reduces this to zero, it also noticably speeds up the macro.

Here is a function that I created, quite advanced now. It assumes there are declarations of:

' Set to allow macros to remember this between runs w/o recreating objects.
Global Screen As Screen

' Displays a dialog box while the session's XStatus is = 5
Sub WaitClocking(SessionName As String, StartTime As Single)


Code:
Declare Sub Wait(Optional Scrn, Optional WarningTime)

' Waits for host to finish
Sub Wait(Optional Scrn, Optional WarningTime)
    Dim S As Object
    If IsMissing(Scrn) Then Set S = Screen Else Set S = Scrn
    If IsMissing(WarningTime) Then WarningTime = 10
    
    Start! = Timer
    Do 
        DoEvents
        If (WarningTime > 0) And (Timer > Start! + WarningTime) Then _
          WaitClocking S.Parent.Name, Start!
    Loop While S.OIA.XStatus = 5
End Sub

Simplified:

Code:
Sub Wait(Screen As Screen)
  Do
    DoEvents
  Loop While Screen.XStatus = 5
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top