HP DesignJet T7200 System Administrator s Guide - Page 38
set objFile =FSO.OpenTextFileConfig.cfg, ForReading
View all HP DesignJet T7200 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 38 highlights
HP DJ UPD SAG objPrinter.Put_ msg = Err.Description On Error GoTo 0 If msg "" Then wscript.echo "Cannot share printer" & objPrinter.Name & ": " & msg End If End If Next End Function This function read from external config file Function ReadConfigValues(configSharing,configVerbosity,configDriverSubfolder,configPort) Dim FSO, objFile, leng, leng2,StrConst,StrConstValue,strText,oArgs Const ForReading = 1 Set FSO = CreateObject("Scripting.FileSystemObject") set objFile =FSO.OpenTextFile("Config.cfg", ForReading) Do Until objFile.AtEndOfStream strText = objFile.Readline if Left(strText,1) ="k" then leng = InStr(strText,"=") leng2 = len(strText) - leng StrConstValue = Right(strText,leng2) StrConst = Left(strText,leng-1) select case StrConst case "kSharing" configSharing = StrConstValue case "kVerbosity" configVerbosity = StrConstValue case "kDriverSubfolder" configDriverSubfolder = StrConstValue case "kPort" set oArgs = wscript.Arguments If oArgs.Count = 0 then configPort = StrConstValue end if case else exit function end select end if Loop end function This function checks that the local port is correct Function CheckPortName(portName) Dim pos, path, fso2 pos = InStrRev(portName, "\") path = Left(portName, pos) Set fso2 = CreateObject("Scripting.FileSystemObject") if Not fso2.FolderExists(path) then 38