Welcome to Dream.In.Code
Getting Help is Easy!

Join 136,303 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,465 people online right now. Registration is fast and FREE... Join Now!




Calling VBS

 
Reply to this topicStart new topic

Calling VBS

spiritnblk
24 Aug, 2008 - 06:32 AM
Post #1

New D.I.C Head
*

Joined: 24 Aug, 2008
Posts: 1

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?

CODE

<%@ 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">

<html xmlns="http://www.w3.org/1999/xhtml" >

<script language="vbscript">

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

End Sub

</script>
<head runat="server">
<title>Untitled Page</title>


</head>


<body>




<form id="form1" runat="server">

<div style="position:absolute;top:325px;left:104px;width:300px;"><asp:ImageButton ID="Copier31" runat="server" ImageUrl="~/Images/1Copier3.gif" OnClientClick="Copier3" /></div>


&nbsp;
<div style="position:absolute;top:681px;left:194px;width:300px;"><asp:ImageButton ID="Copier32" runat="server" ImageUrl="~/Images/2Copier3.gif" /></div>
&nbsp;
<div style="position:absolute;top:786px;left:285px;width:300px;"><asp:ImageButton ID="Copier33" runat="server" ImageUrl="~/Images/3Copier3.gif" /></div>
<div style="position:absolute;top:777px;left:194px;width:300px;"><asp:ImageButton ID="Copier21" runat="server" ImageUrl="~/Images/1Copier2.gif" /></div>


<div style="position:absolute;top:876px;left:104px;width:300px;"><asp:ImageButton ID="Copier22" runat="server" ImageUrl="~/Images/2Copier2.gif" /></div>
<div style="position:absolute;top:892px;left:284px;width:300px;"><asp:ImageButton ID="NOC" runat="server" ImageUrl="~/Images/NOC.gif" /></div>

<div style="position:static;bottom:0px;left:7px;width:400px;"><asp:Image ID="FloorPlan" runat="server" ImageUrl="~/Images/Call Center Ports Plan_Model.gif" /></div>
</form>
</body>

</html>


VBS:
CODE

strPrinter="\\server\copier3"
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")


Mod Edit: Please use code tags when posting your code. Code tags are used like so => code.gif

Thanks,
PsychoCoder smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 06:28AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month