I'm using Python to automate Attachmate - EXTRA !, just as many do with VBA.
I'm using the package pywin32 found here .
I'm following the% method documentation found here / a>.
The problem occurs when I try to set a WaitHostQuiet
to the SettleTime
method, 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')
The error text follows:
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 return self._get_good_object_ (self. oleobj .Invoke (* allArgs), self. olerepr .defaultDispatchName, None)
com_error: (-2147352562, 'Invalid parameter number.', None, None)
However, if I do not set a WaitHostQuiet(SettleTime)
, it works:
if screen.WaitHostQuiet(): # assim funciona
print('yes')
I need to set SettleTime because the default value of 5 seconds is very time consuming for my application and I want to use a smaller 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?