Newbie - pass variable to cscript

Discussion in 'Python' started by plsullivan1@gmail.com, Mar 3, 2009.

  1. Guest

    import os
    os.system('cscript.exe /from: /to:p'
    "C:\\Program Files\\nasa\\nmail.vbs")

    nmail.vbs works. I need to make it work from a python script. Thanks.
     
    , Mar 3, 2009
    #1
    1. Advertising

  2. En Tue, 03 Mar 2009 12:19:22 -0200, <> escribió:

    > import os
    > os.system('cscript.exe /from: /to:p'
    > "C:\\Program Files\\nasa\\nmail.vbs")
    >
    > nmail.vbs works. I need to make it work from a python script. Thanks.


    ....and the problem is...?

    --
    Gabriel Genellina
     
    Gabriel Genellina, Mar 3, 2009
    #2
    1. Advertising

  3. Guest

    On Mar 3, 10:07 am, "Gabriel Genellina" <>
    wrote:
    > En Tue, 03 Mar 2009 12:19:22 -0200, <> escribió:
    >
    > > import os
    > > os.system('cscript.exe /from: /to:p'
    > > "C:\\Program Files\\nasa\\nmail.vbs")

    >
    > > nmail.vbs works. I need to make it work from a python script. Thanks.

    >
    > ...and the problem is...?
    >
    > --
    > Gabriel Genellina


    It's not firing off the vbs script. Have I got the syntax correct?
    Thanks.

    My latest attempt:
    vBS = "C:\\Program Files\\nasa\\nmail.vbs"
    os.system('cscript /from: /
    to:p /sub:TEST /msg:hello ' + vBS)
     
    , Mar 3, 2009
    #3
  4. En Tue, 03 Mar 2009 13:22:20 -0200, <> escribió:

    > On Mar 3, 10:07 am, "Gabriel Genellina" <>
    > wrote:
    >> En Tue, 03 Mar 2009 12:19:22 -0200, <> escribió:
    >>
    >> > import os
    >> > os.system('cscript.exe /from: /to:p'
    >> > "C:\\Program Files\\nasa\\nmail.vbs")

    >>
    >> > nmail.vbs works. I need to make it work from a python script. Thanks.

    >>
    >> ...and the problem is...?
    >>
    >> --
    >> Gabriel Genellina

    >
    > It's not firing off the vbs script. Have I got the syntax correct?
    > Thanks.
    >
    > My latest attempt:
    > vBS = "C:\\Program Files\\nasa\\nmail.vbs"
    > os.system('cscript /from: /
    > to:p /sub:TEST /msg:hello ' + vBS)


    Usually arguments come after the script name:

    vBS = "C:\\Program Files\\nasa\\nmail.vbs"
    os.system('cscript "%s" /from:
    /to:p /sub:TEST /msg:hello' % vBS)

    But I'd use the subprocess module instead of os.system:

    import subprocess
    ret = subprocess.call(['cscript', vBS, '/from:...', '/to:...'])

    See http://docs.python.org/library/subprocess.html

    --
    Gabriel Genellina
     
    Gabriel Genellina, Mar 3, 2009
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert W. Eckert
    Replies:
    4
    Views:
    788
    =?Utf-8?B?Um9iIEVja2VydA==?=
    Oct 5, 2004
  2. Rich
    Replies:
    3
    Views:
    1,557
  3. J M
    Replies:
    1
    Views:
    369
    A. Sinan Unur
    Apr 11, 2005
  4. Sandeeo

    Javascript and CScript

    Sandeeo, Oct 7, 2005, in forum: Javascript
    Replies:
    1
    Views:
    127
    Martin Honnen
    Oct 7, 2005
  5. capt edgar

    Difference between WScript and CScript

    capt edgar, Jan 7, 2010, in forum: Javascript
    Replies:
    2
    Views:
    170
    Thomas 'PointedEars' Lahn
    Jan 7, 2010
Loading...

Share This Page