Help with conversion VB script to Python : COM objects

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mitsura@skynet.be

    #1

    Help with conversion VB script to Python : COM objects

    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(ob jPmad.GetPolicy TypeList)

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

    but then I get the following error:
    "
    Traceback (most recent call last):
    File "C:\Python24\My Progs\FodFin\te st.py", line 11, in ?
    objPolTypes = objPmad.cvar(ob jPmad.GetPolicy TypeList() )
    File "<COMObject PMAD.OvPmdPolic yManager>", line 2, in cvar
    pywintypes.com_ error: (-2147352571, 'Type mismatch.', None, 1)
    "

    I also tried :
    objPolTypes = objPmad.GetPoli cyTypeList()

    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

  • Roger Upole

    #2
    Re: Help with conversion VB script to Python : COM objects


    <mitsura@skynet .be> wrote in message news:1151326097 .306855.11880@y 41g2000cwy.goog legroups.com...[color=blue]
    > 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(ob jPmad.GetPolicy TypeList)
    >
    > Does anybody what the equivalent in Python would be?
    > I tried:
    > objPolTypes = objPmad.Cvar(ob jPmad.GetPolicy TypeList() )
    >
    > but then I get the following error:
    > "
    > Traceback (most recent call last):
    > File "C:\Python24\My Progs\FodFin\te st.py", line 11, in ?
    > objPolTypes = objPmad.cvar(ob jPmad.GetPolicy TypeList() )
    > File "<COMObject PMAD.OvPmdPolic yManager>", line 2, in cvar
    > pywintypes.com_ error: (-2147352571, 'Type mismatch.', None, 1)
    > "
    >
    > I also tried :
    > objPolTypes = objPmad.GetPoli cyTypeList()
    >
    > 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
    >[/color]

    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




    ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= East/West-Coast Server Farms - Total Privacy via Encryption =---

    Comment

    Working...