Hello,
I wrote few years ago, a function in vb script, for the creation of ThinPrint Classes.
But the execution with the Version 8 generates an error , at the "_Put" Method :
"C:\CreationClass.vbs(42, 17) SWbemObjectEx: Generic failure"
I suppose that the objects' properties and Methods, have been changed.
'Below the Code of this function
'----------------------------------------------------------------------------------------
CreateClass "127.0.0.1", "FX100", "_#Epson FX-100", "", ""
Sub CreateClass(ServerName, ClassName, DriverName, Account, PassWord)
Const NameSpace = "root\ThinPrint"
Dim objSWbemLocator, objSWbemServices, objSWbemObject
Dim colTranslation, arrReturn
Dim objTPACTL, objItem
Dim booFlag, i
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
If ServerName = "." OR ServerName = "127.0.0.1" Then
Set objSWbemServices = objSWbemLocator.ConnectServer(ServerName, NameSpace)
Else
Set objSWbemServices = objSWbemLocator.ConnectServer(ServerName, NameSpace, Account, PassWord)
End If
'Getting the class object
Set objSWbemObject = objSWbemServices.Get("TPACTranslationList")
set colTranslation = objSWbemServices.ExecQuery("Select * from TPACTranslationList")
For Each objItem in colTranslation
arrReturn = objItem.TranslationList
Set objTPACTL = objItem
Next
' Translation already exist ?
booFlag = True
For i=0 to UBound(arrReturn) - 1
If arrReturn(i) = ClassName AND arrReturn(i + 1) = DriverName Then
booFlag = False
End If
Next
If booFlag Then
ReDim Preserve arrReturn(UBound(arrReturn) + 1)
arrReturn(UBound(arrReturn)) = ClassName
ReDim Preserve arrReturn(UBound(arrReturn) + 1)
arrReturn(UBound(arrReturn)) = DriverName
objTPACTL.TranslationList = arrReturn
objTPACTL.Put_
RestartTPAutoConnectService ServerName
End If
Set objSWbemObject = Nothing
Set objSWbemServices = Nothing
Set objSWbemLocator = Nothing
End Sub
'--------------------------------------------------------------------------------------------------
Anybody has one idea ?
Xendi.
May the Scripting Force, be with you !