[python-win32] Unable to use win32com on Ecco COM server despite success with VB and Perl COM

Mark Hammond mhammond@skippinet.com.au
Sat, 27 Apr 2002 09:27:43 +1000


The 2 return values are almost certainly because the first param to the
function is flagged as "inout", or ByRef (the default) in VB.

Thus, you get a tuple - the param, and the result.

Unfortunately, I have no idea why this would not be working.  It seems to me
simply that the COM server is returning NULL instead of an object.  Without
knowing details about the object, I really can't say.

Maybe you should try asking the control vendor?

MArk.

> -----Original Message-----
> From: python-win32-admin@python.org
> [mailto:python-win32-admin@python.org]On Behalf Of Raymond Yee
> Sent: Tuesday, 23 April 2002 3:22 AM
> To: python-win32@python.org
> Subject: [python-win32] Unable to use win32com on Ecco COM server
> despite success with VB and Perl COM
>
>
> [I've previously posted to comp.lang.python but am still stuck:
> http://groups.google.com/groups?dq=ccomp.lang.python&hl=en&group=c
omp.lang.python&safe=off&selm=e5eab55e.0204191549.41985d9a%40posting.google.
com]
>
> I've been trying unsuccesfully to use Python to access the functionality
> of the "Visual Basic Toolkit" (http://www.ivitar.com/vbecco/). The
> toolkit is a COM InProc
> Server (.exe).
>
> I'm puzzled as to how to proceed because of two things:  1) My Python
> program is able to use some functions of the toolkit but not others and
> 2) I've had success with both Visual Basic and Perl in accessing the
> toolkit via COM.
>
> Below are the three versions of the program.  Ecco is a personal
> information manager.  This program is supposed to print out the text of
> any selected outline and the corresponding URL in a folder called "Net
> Location"  (The developer key has beeen x'ed out)
>
> In the Perl and VB versions, I am able to get both the "text value" of
> the selected item ($item->Text in Perl) and the corresponding URL
> ($item->FolderValue("Net Location")).  However, in the Python version,
> while EccoItem.Text is what I expect, EccoItem.FolderValue("Net
> Location") returns
>
> (u'Net Location', None)
>
> -- a tuple, whose first item is type unicode.  However, I don't see
> anything in the return value remotely related to the URL I'm trying to
> access.
>
> Any suggestions on how to get Python to work with the toolkit? (Am I
> using the wrong syntax?  Are there options I'm setting right? How should
> I debug this?)
>
> (I'm running ActivePython version 2.2.0 build 221 change 37890 on
> Windows 2000 Professional)
>
>
> Thanks in advance,
>
> -Raymond Yee
>
> ---------------------------------------------------------------
> Python version:
>
> # build OPML from the selected outline (if more than one is selected,
> use the first item
>
> import win32com.client
> Ecco = win32com.client.Dispatch("VBEcco.EccoApp")
> Ecco.Register("xxxxxxxx", -1, -1)
> EccoSelection = Ecco.Selection
>
> #print value of item in Net Location folder
>
> for EccoItem in EccoSelection:
>     print "Text: " + EccoItem.Text
>     print EccoItem.FolderValue("Net Location")
>
> ---------------------------------------------------------------
>
> Perl version:
>
> # establish COM connection to Ecco
>
> use Win32::OLE qw(in);
> #use Win32::OLE::in;
>
> my($ecco, $sel, $item);
>
> $ecco = Win32::OLE->new("VBEcco.EccoApp", 'Quit');
> $ecco->Register("xxxxxxxx", -1, -1);
>
> $sel = $ecco->Selection;
>
> foreach $item (in($sel)) {
>
>     print $item->Text, "\n";
>     print $item->FolderValue("Net Location") , "\n";
>
> }
>
> ---------------------------------------------------------------
>
> Visual Basic version:
>
> Option Explicit
>
> 'Place in Declarations
> Dim Ecco As EccoApp
> Dim EccoSelection As EccoItems
> Dim EccoItem As EccoItem
>
> Private Sub Form_Load()
>
> Set Ecco = New EccoApp
> Ecco.Register "xxxxxxxx", -1, -1
>
> ' Get Selections
> Set EccoSelection = Ecco.Selection
>
> 'if there is a first selection, print out the text, and figure out
> whether there is an associated URL in the Net Location folder
>
> For Each EccoItem In EccoSelection
>     MsgBox ("Text: " + EccoItem.Text)
>     MsgBox ("NL: " + EccoItem.FolderValue("Net Location"))
> Next
>
>
> End Sub
>
> --
> Raymond Yee                          44 Barrows Hall, #3810
> Technology Architect                            UC Berkeley
> Interactive University Project      Berkeley, CA 94720-3810
> yee@uclink.berkeley.edu                 510-642-0476 (work)
> http://www.raymondyee.net               413-541-5683  (fax)
>
>
>
>
> _______________________________________________
> Python-win32 mailing list
> Python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32