A while ago I asked how VBScript can be called from Python. The two answers
I received suggested using win32com.client and
MSScriptControl.ScriptControl. This solution required embedding the VBScript
code inside the Python script.

Here's  a shell approach that runs an existing VBScript file:

Python script
import os
import sys
os.system("F:\Projects\Doc\Scripts\VBScript\WriteDataToTextFile.vbs")

VBScript:
' WriteDataToTextFile.vbs
Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
    ("c:\temp\temp.txt", ForAppending, True)
Set objNetwork = CreateObject("Wscript.Network")
objComputerName = objNetwork.ComputerName
objTextFile.WriteLine("My computer's name is")
objTextFile.WriteLine(objComputerName)
objTextFile.Close

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to