[python-win32] Trouble Automating Alibre CAD package

Duane Kaufman duaneklean at tds.net
Fri Jul 7 05:06:10 CEST 2006


Hi,

Thanks for the idea.

When I create a minimal project in MS Basic Express (console App) the following works:

Module Module1

    Sub Main()
        Dim AlibreHook As AlibreX.AutomationHook        AlibreHook = GetObject(, "AlibreX.AutomationHook")
        Dim AlibreRoot As AlibreX.IADRoot        AlibreRoot = AlibreHook.Root
        Console.WriteLine("Version " & AlibreRoot.version)
    End Sub

End Module

When I try the same thing in a vbs script, and run with wscript:

        Dim AlibreHook        AlibreHook = GetObject(, "AlibreX.AutomationHook")
        Dim AlibreRoot        AlibreRoot = AlibreHook.Root
        WScript.Echo("Version " & AlibreRoot.version)

I get the error:
Line: 4
Char: 9
Error: Object required
Code: 800A01A8
Source: Microsoft VBScript runtime error

The TypeName(AlibreRoot) in the second example yields 'Unknown'

All of the examples have this component started and attach to a running instance with GetObject.

Any new insights?

THanks,
Duane> 
> I think trying to create the object using VBScript is a good idea.
> This way you will know who to blame (pywin or the component).
> 
> ===ThisIsJustATestIWouldLikeToDoItInPython.vbs ===
> Dim x
> Set x = CreateObject ("AlibreX.AutomationHook")
> ===EOF==
> 
> Does it work?
> 
> I'm not 100% sure, but AFAIK VB doesn't need the IDispatch, as far as
> the component provide a type library and oleautomation types.
> 
> Mark: can dispatch-less objects be used from win32com?
> 
> Rodrigo Strauss
> 
> On 7/6/06, duanek at chorus.net <duanek at chorus.net> wrote:
> > Hello,
> >
> > I am trying to use pywin32 to automate a CAD package from Alibre (www.alibre.com) called Design Express.
> >
> > The documentation I can get is written for Visual Basic (and not all that well at that), and I get the following error from the following lines:
> >
> > [Python Code]
> >         import win32com.client
> >                         AlibreObject=win32com.client.Dispatch(r"AlibreX.AutomationHook")
> > [End Python code]
> >
> > Error traceback:
> >     AlibreObject = win32com.client.Dispatch(r"AlibreX.AutomationHook")
> >   File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
> >     dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
> >   File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName> >     return (_GetGoodDispatch(IDispatch, clsctx), userName)
> >   File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 78, in _GetGoodDispatch> >     IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
> > pywintypes.com_error: (-2147467262, 'No such interface supported', None, None)
> >
> >
> > Any ideas what to try next?
> >
> > Thanks,
> > Duane> >
> >
> > _______________________________________________
> > Python-win32 mailing list
> > Python-win32 at python.org> > http://mail.python.org/mailman/listinfo/python-win32
> >
> _______________________________________________
> Python-win32 mailing list
> Python-win32 at python.org> http://mail.python.org/mailman/listinfo/python-win32
> 




More information about the Python-win32 mailing list