Well I am calling a VBScript inside a python code. I get error "ActiveX component can't create object" But it is fine When I call Seperate (When I double click that or run using cmd).
This is part of python code. I tried csript, wscript. changed the path to system32 / SYSVOW64.. But nothing is working
for i in range(printInput):
print("range")
print(i)
os.system(r"C:\Windows\system32\cmd.exe /k c:\windows\SysWOW64\cscript.exe C:\Users\muneeb.kalathil\PycharmProjects\moodledownload\vcconverter\labelprint\new.vbs")
#subprocess.call("run.bat")
And this is VBSscript
'<SCRIPT LANGUAGE="VBScript">
' Data Folder
Const sDataFolder = "C:\Users\muneeb.kalathil\PycharmProjects\moodledownload\vcconverter\labelprint\"
DoPrint(sDataFolder & "label.lbx")
'*******************************************************************
' Print Module
'*******************************************************************
Sub DoPrint(strFilePath)
Set ObjDoc = CreateObject("bpac.Document")
bRet = ObjDoc.Open(strFilePath)
If (bRet <> False) Then
ObjDoc.GetObject("AssetName").Text = "text"
ObjDoc.GetObject("AssetTag").Text = "text"
ObjDoc.GetObject("company").Text = "text"
Call ObjDoc.SetBarcodeData(ObjDoc.GetBarcodeIndex("QR"), "link")
' ObjDoc.SetMediaByName ObjDoc.Printer.GetMediaName(), True
ObjDoc.StartPrint "", 0
ObjDoc.PrintOut 1, 0
ObjDoc.EndPrint
ObjDoc.Close
End If
Set ObjDoc = Nothing
End Sub
It shows the error in
Set ObjDoc = CreateObject("bpac.Document")