Help with conversion VB script to Python : COM objects

M

mitsura

Hi,

I need to re-write a VB script into Python (because I really don't like
VB).

The VB script is used to create a Windows COM object.
(I am more of Unix guy, so COM objects are a little bit alien for me).

At a certain point in the VB script, I have the following line:
objPolTypes = objPmad.Cvar(objPmad.GetPolicyTypeList)

Does anybody what the equivalent in Python would be?
I tried:
objPolTypes = objPmad.Cvar(objPmad.GetPolicyTypeList() )

but then I get the following error:
"
Traceback (most recent call last):
File "C:\Python24\MyProgs\FodFin\test.py", line 11, in ?
objPolTypes = objPmad.cvar(objPmad.GetPolicyTypeList() )
File "<COMObject PMAD.OvPmdPolicyManager>", line 2, in cvar
pywintypes.com_error: (-2147352571, 'Type mismatch.', None, 1)
"

I also tried :
objPolTypes = objPmad.GetPolicyTypeList()

this works but I end of with a list of COM object and have no clue how
to query/use them or what methods are defined for those type of
objects.

Any help really appreciated.

With kind regards,

KRis
 
R

Roger Upole

Hi,

I need to re-write a VB script into Python (because I really don't like
VB).

The VB script is used to create a Windows COM object.
(I am more of Unix guy, so COM objects are a little bit alien for me).

At a certain point in the VB script, I have the following line:
objPolTypes = objPmad.Cvar(objPmad.GetPolicyTypeList)

Does anybody what the equivalent in Python would be?
I tried:
objPolTypes = objPmad.Cvar(objPmad.GetPolicyTypeList() )

but then I get the following error:
"
Traceback (most recent call last):
File "C:\Python24\MyProgs\FodFin\test.py", line 11, in ?
objPolTypes = objPmad.cvar(objPmad.GetPolicyTypeList() )
File "<COMObject PMAD.OvPmdPolicyManager>", line 2, in cvar
pywintypes.com_error: (-2147352571, 'Type mismatch.', None, 1)
"

I also tried :
objPolTypes = objPmad.GetPolicyTypeList()

this works but I end of with a list of COM object and have no clue how
to query/use them or what methods are defined for those type of
objects.

Any help really appreciated.

With kind regards,

KRis

If the application has a typelib, you can use makepy to generate a wrapper
module that will show you the objects' methods and properties.
Otherwise, you'll have to depend on the documentation for the app.

Roger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top