Don't be surprised if what I'm doing is completely wrong or if the solution is obvious.
<script type="text/vbscript">
Function AddPrinter()
Set objNetwork = CreateObject("WScript.Network")
objNetwork.AddWindowsPrinterConnection "\\a2031slhsfile1\2031CAT-T113-HP4014dn"
objNetwork.SetDefaultPrinter "\\a2031slhsfile1\2031CAT-T113-HP4014dn"
MsgBox "The printer was added and set as the default printer."
End Function
</script>
I added the above vbscript to an HTML document in the head section and one of the buttons has the following property:
onclick="AddPrinter()"
I didn't find much about this when searching on Google for an hour. What I did find didn't work. How does it know whether you're calling the function from javascript or vbscript or whatever anyway?
I get this error:
SCRIPT429: ActiveX component can't create object: 'WScript.Network'