Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Calling VBS

I'm not too sure where the following is going wrong. For now I'm just trying to get the first button to work. Any ideas?


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">





Public Sub Copier3()
Set objWSH = CreateObject("WScript.Shell")
strCMD = "cscript.exe C:PMPCopier3.vbs"
objWSH.Run(strCMD)

End Sub



Untitled Page















 

 














VBS:

strPrinter="\servercopier3"
Set WshNetwork = CreateObject("WScript.Network")
Set WshShell = CreateObject("WScript.Shell")
WshNetwork.AddWindowsPrinterConnection strPrinter
WshNetwork.SetDefaultPrinter strPrinter

MsgBox strPrinter & " Printer connected and set as the default printer"
Set WshNetwork = WScript.CreateObject("WScript.Network")




Sign In or Register to comment.