WSH 2.0 and the AddPrinterConnection ? 
Author Message
 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>



Thu, 23 May 2002 03:00:00 GMT  
 WSH 2.0 and the AddPrinterConnection ?

Look in the WSH documentation: http://msdn.microsoft.com/scripting/windowshost/docs/reference/defaul...

--
Michael Harris


  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>



Thu, 23 May 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. WSH, IIS, AddPrinterConnection : access is denied (security context)

2. "Broken" WSH 2.0

3. WSH 2.0?

4. Deploying WSH 2.0

5. SetDefaultPrinter Method and WSH 2.0

6. WSH 2.0 install

7. WSH 2.0 newsletter available

8. Question about WSH 2.0 TypeLibrary support?

9. Is WSH 2.0 installed with IE5.01?

10. WSH 2.0 include

11. What happen with WSF and DEBUG (WSH 2.0 Final Version)

12. How to debug in WSH 2.0

 

 
Powered by phpBB® Forum Software