
WSH 2.0 and the AddPrinterConnection ?
Looking through a magazine i came accross some information about the
AddPrinterConnection tool in WScript.Network. However i can't find any
information on it in the help or anywhere else.
I have the rest of the programming done but i need to know how to present
the data. Also I often get device driver errors. Does this mean i have to
specify the device driver?
Any help greatfully received
Dominic Marks.
My Coding so far, (any comments on this are welcome to...)
<script language=VBScript>
Function B1_OnClick() ' the whole thing is packaged in a form.
Dim P, Pt, N, D, Dic
Set Dic = CreateObject("Scripting.Dictionary")
Set D = Document.Form
Set N = CreateObject("WScript.Network")
P = D.T1.Value
Dic.add "a", ""&P
If Dic.Item("a") = Empty then
MsgBox "Printers must be named",,"Un-named Printer"
End If
Pt = D.T2.Value
Dic.add("b"), ""&Pt
If Dic.Item("b") = Empty then
MsgBox "Printers must have paths",,"Pathless Printer"
End If
MsgBox ""&Dic.Item("a") ' to check the dictionary entries
MsgBox ""&Dic.Item("b") ' as above
N.AddPrinterConnection ""&Dic.Item("a"), &Dic.Item("b") ' This is the prob.
Currently i have guessed at the structure from the one from the
MapNetworkDrive tool.
End Function
</script>