[python-win32] OE/WAB help with VB ...
Clinton Lee Taylor
clintonlee.taylor at gmail.com
Mon Mar 10 16:45:23 CET 2008
Greetings ...
> > I have found a nice little LGPL library that I hope will make my life
> > and many others easier ... http://www.nektra.com/products/wab/
> >
> > If I understand the docs, it's an activeX component, with a nice
> > little VB app, but I'm a total noob at both languages and total lost
> > in all com stuff and dll this and some other stuff ...
> >
> > If anybody could look at the VB app and give me a hand at starting a
> > basic python script that just can dump the names from the WAB, it
> > would rally help to have a working example to work from ...
Thanks Roger for your quick response ... I hope that I might get a
little further help ...
A quick cut and paste and run to see if this works ...
> import win32com.client
> n=win32com.client.Dispatch('NKTWABLib.NKTWAB')
> r=n.RootFolder
> print r.Name
> print r.Folders.Count
> for folder_num in range(1, r.Folders.Count+1):
> f=r.Folders[folder_num]
> print f.Name, 'Groups:', f.Groups.Count, 'Contacts:', f.Contacts.Count
> for contact_num in range(1, f.Contacts.Count+1):
> c=f.Contacts[contact_num]
> print '\t',c.Email1Address
I get ...
Traceback (most recent call last):
File "D:\Hyplex\outlook\Hylapex\WAB-Contacts-02.py", line 5, in -toplevel-
r=n.RootFolder
File "C:\Python24\Lib\site-packages\win32com\client\__init__.py",
line 455, in __getattr__
return self._ApplyTypes_(*args)
File "C:\Python24\Lib\site-packages\win32com\client\__init__.py",
line 446, in _ApplyTypes_
return self._get_good_object_(
com_error: (-2147352559, 'Does not support a collection.', None, None)
I think I get this because com objects have to be "imported" ... But
this ActiveX object does not seem to have a "type lib"? ...
So I tried the following ...
import win32com.client
n=win32com.client.gencache.EnsureDispatch("NKTWABLib.NKTWAB")
print n
and I get ...
>>>
<win32com.gen_py.Nektra NKTWAB library.INKTWAB instance at 0x20367160>
>>>
Again, I tried ...
import win32com.client
n=win32com.client.gencache.EnsureDispatch("NKTWABLib.NKTWAB")
print n
r=n.RootFolder
print r.Folders.Count
and I get ...
>>> ================================ RESTART ================================
>>>
<win32com.gen_py.Nektra NKTWAB library.INKTWAB instance at 0x20367160>
Traceback (most recent call last):
File "D:/Hyplex/outlook/Hylapex/WAB-Contacts-03.py", line 6, in -toplevel-
r=n.RootFolder
File "C:\Python24\Lib\site-packages\win32com\client\__init__.py",
line 455, in __getattr__
return self._ApplyTypes_(*args)
File "C:\Python24\Lib\site-packages\win32com\client\__init__.py",
line 446, in _ApplyTypes_
return self._get_good_object_(
com_error: (-2147352559, 'Does not support a collection.', None, None)
>>>
... So, how lost am I?
Thanks for all the help.
Mailed
LeeT
More information about the python-win32
mailing list