FW: executing VBScript from Python and vice versa

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Valentina Boycheva

    FW: executing VBScript from Python and vice versa

    Thanks for the reply. I already have "Learning Python" from Mark Lutz and
    David Ascher, which covers 2.3 (I am in 2.4). However, it seems like heavy
    artillery to me. What I want is, for instance, run a VBScript to get a
    function output and feed it to the Python script that called it. The reason
    is that because I feel more comfortable with VBScript and have written a
    small library of useful utilities, I don't want it to become obsolete. In
    the mean time I did more reading and found a couple of prospective
    alternatives - popen and os.system(comma nd). Still need to work out how to
    use them...

    -----Original Message-----
    From: aurora [mailto:aurora00 @gmail.com]
    Sent: Friday, February 04, 2005 3:28 PM
    To: python-list@python.org
    Subject: Re: executing VBScript from Python and vice versa

    Go to the bookstore and get a copy of Python Programming on Win32
    by Mark Hammond, Andy Robinson today.



    It has everything you need.
    [color=blue]
    > Is there a way to make programs written in these two languages
    > communicate
    > with each other? I am pretty sure that VBScript can access a Python
    > script
    > because Python is COM compliant. On the other hand, Python might be able
    > to
    > call a VBScript through WSH. Can somebody provide a simple example? I
    > have
    > exactly 4 days of experience in Python (and fortunately, much more in
    > VB6)
    >
    > Thanks.
    >[/color]


  • Tim Hoffman

    #2
    Re: FW: executing VBScript from Python and vice versa

    PythonWin 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)]
    on win32.
    Portions Copyright 1994-2004 Mark Hammond (mhammond@skipp inet.com.au) -
    see 'Help/About PythonWin' for further copyright information.[color=blue][color=green][color=darkred]
    >>> from win32com.client import Dispatch
    >>> x = Dispatch("MSScr iptControl.Scri ptControl")
    >>> x.Language='VBS cript'
    >>> x.AddCode("""Fu nction HelloWorld[/color][/color][/color]
    .... HelloWorld = "hello world"
    .... End Function
    .... """)[color=blue][color=green][color=darkred]
    >>>
    >>> x.Eval("HelloWo rld")[/color][/color][/color]
    u'hello world'[color=blue][color=green][color=darkred]
    >>>[/color][/color][/color]

    Valentina Boycheva wrote:[color=blue]
    > Thanks for the reply. I already have "Learning Python" from Mark Lutz and
    > David Ascher, which covers 2.3 (I am in 2.4). However, it seems like heavy
    > artillery to me. What I want is, for instance, run a VBScript to get a
    > function output and feed it to the Python script that called it. The reason
    > is that because I feel more comfortable with VBScript and have written a
    > small library of useful utilities, I don't want it to become obsolete. In
    > the mean time I did more reading and found a couple of prospective
    > alternatives - popen and os.system(comma nd). Still need to work out how to
    > use them...
    >
    > -----Original Message-----
    > From: aurora [mailto:aurora00 @gmail.com]
    > Sent: Friday, February 04, 2005 3:28 PM
    > To: python-list@python.org
    > Subject: Re: executing VBScript from Python and vice versa
    >
    > Go to the bookstore and get a copy of Python Programming on Win32
    > by Mark Hammond, Andy Robinson today.
    >
    > http://www.oreilly.com/catalog/pythonwin32/
    >
    > It has everything you need.
    >
    >[color=green]
    >>Is there a way to make programs written in these two languages
    >>communicate
    >>with each other? I am pretty sure that VBScript can access a Python
    >>script
    >>because Python is COM compliant. On the other hand, Python might be able
    >>to
    >>call a VBScript through WSH. Can somebody provide a simple example? I
    >>have
    >>exactly 4 days of experience in Python (and fortunately, much more in
    >>VB6)
    >>
    >>Thanks.
    >>[/color]
    >
    >
    >[/color]

    Comment

    Working...