I have a page with a bit of VBScript that launches a printer installation when the button is clicked. There is an alert once the script has completed successfully.
I am now trying to add another button click event (possibly using jQuery), that notifies the user that the printer installation has started (on button click). This is due to the fact that it can take anywhere from 20 seconds to a minute for the printer to be installed.
When implementing the following code, I am getting an error that an object is being expected from within the jQuery code block
<script type="text/vbscript">
function AddP(pName)
Set WshNetwork = CreateObject("Wscript.Network")
WshNetwork.AddWindowsPrinterConnection pName
MsgBox "Printer Added"
end function
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
$(document).ready( function (){
$("#btn").click( function(){
alert("Printer Install Started");
});
});
</script>
<td><a href="#" language="vbscript" onclick="AddP('\\PrinterName')"><input id="btn" name="Button1" type="button" value="Add"></a></td>
If you want to give the user some indication something is happening while the printer is being added you could change the button state.