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 into a html as 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. While the script seems to run, there are 2 issues. First, the printer never actually gets installed. And secondly, it opens in a new tab in IE. I don't want that to happen. Any help would be appreciated. Here is the script I am trying to get to work.
<html>
<head>
</head>
<p><font face="Verdana">Printer connection...</font></p>
<SCRIPT LANGUAGE="VBScript">
<!--
on error resume next
Set WshNetwork = CreateObject("WScript.Network")
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
history.back()
-->
</SCRIPT>
</html>
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 into a html as 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. While the script seems to run, there are 2 issues. First, the printer never actually gets installed. And secondly, it opens in a new tab in IE. I don't want that to happen. Any help would be appreciated. Here is the script I am trying to get to work.
<html>
<head>
</head>
<p><font face="Verdana">Printer connection...</font></p>
<SCRIPT LANGUAGE="VBScript">
<!--
on error resume next
Set WshNetwork = CreateObject("WScript.Network")
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
history.back()
-->
</SCRIPT>
</html>