Attachmate Waithostquiet Method - Extra! with python

Asked

Viewed 707 times

4

I’m using Python to automate Attachmate - EXTRA! as many do with VBA.

I’m using the package pywin32 found here.

I’m following the method documentation WaitHostQuiet found here.

The problem occurs when I try to define a SettleTime for the method WaitHostQuiet(SettleTime), as below:

import win32com.client

system = win32com.client.Dispatch('EXTRA.System')
session = system.ActiveSession
screen = session.Screen
settletime = 1000    

screen.SendKeys('<Enter>')
if screen.WaitHostQuiet(settletime): # o erro acontece nessa linha
    print('yes')

Follow the error text:

Traceback (Most recent call last):

File "", line 1, in screen.Waithostquiet(settletime)

File "C: Users xxx Appdata Local Continuum Anaconda3 lib site-Packages win32com client Dynamic.py", line 197, in call self. _get_good_object_(self.oleobj.Invoke(*allArgs),self.replace.defaultDispatchame,None)

com_error: (-2147352562, 'Invalid parameter number. ', None, None)

However, if I do not define a SettleTime, works:

if screen.WaitHostQuiet(): # assim funciona
    print('yes')

I need to define Settletime, because the default value of 5 seconds is very time consuming for my application and I want to use a lower value.

When I write the code in VBA everything works:

Sub Teste()
    Dim system As Object, session As Object, screen As Object, settletime As Integer

    Set system = CreateObject("EXTRA.System")
    Set session = system.ActiveSession
    Set screen = session.screen
    settletime = 1000

    screen.SendKeys ("<Enter>")

    If screen.WaitHostQuiet(settletime) Then
        Debug.Print ("Yes")
    End If
End Sub

Does anyone know what might be causing the error?

1 answer

0

In vba I use this way to wait for a text to appear on the screen, this object does not return true/false it just waits a certain time

SUB ESPERAR_TEXTO(nLin as integer,nCol as integer,nTam as integer,sTexto as String)

    DO WHILE Sessao.Screen.OIA.xStatus = 5
        IF Trim(Sessao.Screen.GetString(nLin,nCol,nTam)) <> sTexto THEN
            Sessao.Screen.WaitHostQuiet(1000)
        END IF
    Loop


END SUB

Browser other questions tagged

You are not signed in. Login or sign up in order to post.