cmdavis13
02-25-2003, 07:40 PM
I wanted to convert this visual basic script to JavaScript to embed in a web page.
I can call the vbs file from a link in the browser but that forces a diolog box that asks the user if they want to download or open the file.
The script is designed to run from a web page for w2k users to install network printers instead of using the standard windows add printer wizard.
I have not been able to find compatible code for the network printer objects.
***** sample code *********
'*** Set printer path
call SetPrinter("\\printserver\printername")
wscript.quit
'*** This subroutine installs and sets the default printer
Sub SetPrinter(ByVal PrinterPath)
DIM WshNetwork
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection(PrinterPath)
End Sub
******* end of code **********
I can call the vbs file from a link in the browser but that forces a diolog box that asks the user if they want to download or open the file.
The script is designed to run from a web page for w2k users to install network printers instead of using the standard windows add printer wizard.
I have not been able to find compatible code for the network printer objects.
***** sample code *********
'*** Set printer path
call SetPrinter("\\printserver\printername")
wscript.quit
'*** This subroutine installs and sets the default printer
Sub SetPrinter(ByVal PrinterPath)
DIM WshNetwork
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection(PrinterPath)
End Sub
******* end of code **********