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?