HP DesignJet Z6600 System Administrator s Guide - Page 38

set objFile =FSO.OpenTextFileConfig.cfg, ForReading

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

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40

HP DJ UPD SAG
38
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