PythonCOM Problem: Automating WinFAX from Python

Stefan Schukat SSchukat at dspace.de
Wed May 22 03:51:33 EDT 2002


Hi, 

the MFC Wrapper (COleDispatchDriver) which is described in the SDK 
does not translate the functions marked as properties in the interface
to properties of the object. In Python this is done, so the translated
code would be:

>>> import win32com
>>> import win32com.client
>>> send_obj = win32com.client.Dispatch("WinFax.SDKSend")
>>> appObj = send_obj.Application
>>> appObj.LeaveRunning(1)
>>> del send_obj

Or try to use 

>>> from win32com.client import gencache
>>> send_obj = gencache.EnsureDispatch("WinFax.SDKSend")

and if a typelib is registerd you will get the full intellitips.


	Stefan


-----Original Message-----
From: Tino Lange [mailto:tl_news at nexgo.de]
Sent: Tuesday, May 21, 2002 5:38 PM
To: python-list at python.org
Subject: PythonCOM Problem: Automating WinFAX from Python


Hi!

I have a problem with com-based WinFAX (10.02) remote programming.
According to the SDK documentation I need to dispatch an arbitrary
SDKObject to get the pionter to the "mother-object" Application
Server.

"The Application Object is not accessible through "CoCreateInstance"
or CoGetClassObject" as there are no registry entries associated with
this object. The client usually holds a pointerto one of the other
WinFax Automation Server Interfaces, which it can use to obtain the
application object."

In short:

How can I translate the following C++-Code to python?

// Create application object
if (m_sendObj.CreateDispatch("WinFax.SDKSend"))
{
  m_appObj.AttachDispatch(m_sendObj.GetApplication());
  m_appObj.LeaveRunning(1);
  m_sendObj.ReleaseDispatch();
  ...
}


This doesn't work:

>>> import win32com
>>> import win32com.client
>>> send_obj = win32com.client.Dispatch("WinFax.SDKSend")
>>> send_obj.GetApplication()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\PROGRA~1\Python2.1\win32com\client\dynamic.py", line 438,
in __getatt
r__
    raise AttributeError, "%s.%s" % (self._username_, attr)
AttributeError: WinFax.SDKSend.GetApplication
>>> send_obj.GetApplication
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\PROGRA~1\Python2.1\win32com\client\dynamic.py", line 438,
in __getatt
r__
    raise AttributeError, "%s.%s" % (self._username_, attr)
AttributeError: WinFax.SDKSend.GetApplication
>>> 

Any ideas or hints?
Thanks a lot for your help!

Tino
 
-- 
http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list