Guys,
I have a working vb script that installs a printer and then asks if it should be set as the default printer. The script works great. However, I want to convert it so it is webpage friendly. I want this to run when someone clicks on a link. If I just use the file itself, it asks to run or save, than prompts the user if they are sure they want to run the script. I don't want any of that to happen. I want them to click the link and have it run, thats it. I originally posted this on another forum in here since I thought it could be simply converted to html, but someone there suggested it was better to try and get this to work in java script, so I wanted to repost it to you guys. Any help would be appreciated.
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\server\printer"
PrinterPath = "\\server\printer"
msg="Do you want " & PrinterPath & " to be Default printer?"
answ=msgbox(msg,vbYesNoCancel,"Add Printer")
If answ=vbYes then
WshNetwork.AddWindowsPrinterConnection PrinterPath
WshNetwork.SetDefaultPrinter PrinterPath
elseif answ=vbNo then
WshNetwork.AddWindowsPrinterConnection PrinterPath
end if
I have a working vb script that installs a printer and then asks if it should be set as the default printer. The script works great. However, I want to convert it so it is webpage friendly. I want this to run when someone clicks on a link. If I just use the file itself, it asks to run or save, than prompts the user if they are sure they want to run the script. I don't want any of that to happen. I want them to click the link and have it run, thats it. I originally posted this on another forum in here since I thought it could be simply converted to html, but someone there suggested it was better to try and get this to work in java script, so I wanted to repost it to you guys. Any help would be appreciated.
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\server\printer"
PrinterPath = "\\server\printer"
msg="Do you want " & PrinterPath & " to be Default printer?"
answ=msgbox(msg,vbYesNoCancel,"Add Printer")
If answ=vbYes then
WshNetwork.AddWindowsPrinterConnection PrinterPath
WshNetwork.SetDefaultPrinter PrinterPath
elseif answ=vbNo then
WshNetwork.AddWindowsPrinterConnection PrinterPath
end if