executing VBScript from Python and vice versa
News M Claveau /Hamster-P
essai1 at mci.local
Sat Feb 5 03:45:40 EST 2005
Cool. :-)
And it's OK, also, for JScript (MS-Javascript) :
import win32com.client
vbs = win32com.client.Dispatch("ScriptControl")
vbs.language = "vbscript"
scode="""Function mul2(x)
mul2=x*2
End Function
"""
vbs.addcode(scode)
print vbs.eval("mul2(123)")
js = win32com.client.Dispatch("ScriptControl")
js.language = "jscript"
scode="""function mul3(x){
vret=x*3;
return(vret);
}
function mul4(x){
vret=x*4;
return(vret);
}
"""
js.addcode(scode)
print js.eval("mul3(123);")
print js.eval("mul4(121);")
@-salutations
--
Michel Claveau
More information about the Python-list
mailing list