Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Newbie - pass variable to cscript

Reply
Thread Tools

Newbie - pass variable to cscript

 
 
plsullivan1@gmail.com
Guest
Posts: n/a
 
      03-03-2009
import os
os.system('cscript.exe /from:(E-Mail Removed) /to(E-Mail Removed)'
"C:\\Program Files\\nasa\\nmail.vbs")

nmail.vbs works. I need to make it work from a python script. Thanks.
 
Reply With Quote
 
 
 
 
Gabriel Genellina
Guest
Posts: n/a
 
      03-03-2009
En Tue, 03 Mar 2009 12:19:22 -0200, <(E-Mail Removed)> escribió:

> import os
> os.system('cscript.exe /from:(E-Mail Removed) /to(E-Mail Removed)'
> "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

 
Reply With Quote
 
 
 
 
plsullivan1@gmail.com
Guest
Posts: n/a
 
      03-03-2009
On Mar 3, 10:07*am, "Gabriel Genellina" <(E-Mail Removed)>
wrote:
> En Tue, 03 Mar 2009 12:19:22 -0200, <(E-Mail Removed)> escribió:
>
> > import os
> > os.system('cscript.exe /from:(E-Mail Removed) /to(E-Mail Removed)'
> > "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:(E-Mail Removed) /
to(E-Mail Removed) /sub:TEST /msg:hello ' + vBS)
 
Reply With Quote
 
Gabriel Genellina
Guest
Posts: n/a
 
      03-03-2009
En Tue, 03 Mar 2009 13:22:20 -0200, <(E-Mail Removed)> escribió:

> On Mar 3, 10:07*am, "Gabriel Genellina" <(E-Mail Removed)>
> wrote:
>> En Tue, 03 Mar 2009 12:19:22 -0200, <(E-Mail Removed)> escribió:
>>
>> > import os
>> > os.system('cscript.exe /from:(E-Mail Removed) /to(E-Mail Removed)'
>> > "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:(E-Mail Removed) /
> to(E-Mail Removed) /sub:TEST /msg:hello ' + vBS)


Usually arguments come after the script name:

vBS = "C:\\Program Files\\nasa\\nmail.vbs"
os.system('cscript "%s" /from:(E-Mail Removed)
/to(E-Mail Removed) /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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
xp pro cscript Molecule Computer Support 3 11-14-2009 07:34 PM
newbie - returned values from cscript.exe Rich Python 3 01-26-2007 04:32 PM
wmi providers and cscript.exe Anthony LaMark Windows 64bit 3 01-26-2006 06:57 AM
IIS calling cscript.exe from cgi permission denied - WMI access J M Perl Misc 1 04-11-2005 11:01 AM
Aspnet_wp.exe process locks internet explorer/ any process utilizing windows scripting (cscript) Robert W. Eckert ASP .Net 4 10-05-2004 10:39 PM



Advertisments