Unable to use win32com on Ecco COM server despite success with VB and Perl COM

Raymond Yee yee at uclink.berkeley.edu
Fri Apr 19 19:49:17 EDT 2002


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?)

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



More information about the Python-list mailing list