Jump to content

Making a user interface with MSG.exe and VBScript?


Recommended Posts

Hello, i'm wondering if someone could lend me a hand on how to let people select a workstation with the drop down menu as shown, and then type the message that will pop up via MSG.exe and hit submit and it will be received. My script so far is just

</HEAD>
<BODY>
<SCRIPT LANGUAGE="VBScript">

Sub Window_OnLoad
    Window.Site.Focus
End Sub

Sub btn01_OnClick
    msg = "C:\Windows\System32\msg.exe"
    RunWait()

End Sub

Sub btn02_OnClick
    Window.Close
End Sub
</SCRIPT>

<H2>Drop Down Example</H2>
<P>Please select the station: 
<SELECT NAME="Site">
    <OPTION>ENCP001</OPTION>
    <OPTION>ENCP002</OPTION>
    <OPTION>ENCP003</OPTION>
    <OPTION>ENCP004</OPTION>
    <OPTION>ENCP005</OPTION>
    <OPTION>ENCP006</OPTION>
    <OPTION>ENCP007</OPTION>
    <OPTION>ENCP008</OPTION>
    <OPTION>ENCP009</OPTION>
    <OPTION>ENCP010</OPTION>
    <OPTION>ENCP011</OPTION>
    <OPTION>ENCP012</OPTION>
    <OPTION>ENCP013</OPTION>
    <OPTION>ENCP016</OPTION>
</SELECT><P>
<BR>
<BR>

<Input = InputBox("Enter your message")>


<BR>
<BR>
<Input Type = "Button" Name = "btn01" VALUE = "SUBMIT">
<Input Type = "Button" Name = "btn02" VALUE = "CLOSE">
<BR>
<BR>

</BODY>

K00C0KJ.jpg

Link to post
Share on other sites
  • 2 months later...

One way
 

</HEAD>
<BODY>
<SCRIPT LANGUAGE="VBScript">

Sub Window_OnLoad
    Window.Site.Focus
End Sub

Sub btn01_OnClick
'Define CMD to Execute
    strCMD = "C:\Windows\System32\msg.exe"

'Collect Selected Option
    With document.all.site
        strSite = .item(.selectedIndex).text
    End With

'Collect MSG
    strMSG = document.all.input.value
    If strMSG & "MT" = "MT" Then 
        msgbox "MSG cannot be blank.", , "Invalid MSG"
        Exit Sub
    End If

'Create Parameters
    strParams = " /SERVER:" & strSite & " " & chr(34) & strMSG & chr(34)

'Execute CMD
    msgbox strCMD & strParams, , "CMD to Execute"

    Set WshShell = CreateObject("WScript.Shell")
    'wshShell.Run(strCMD & strParams, 0, True)
End Sub

Sub btn02_OnClick
    Window.Close
End Sub
</SCRIPT>

<H2>Drop Down Example</H2>
<P>Please select the station: 
<SELECT NAME="Site">
    <OPTION>ENCP001</OPTION>
    <OPTION>ENCP002</OPTION>
    <OPTION>ENCP003</OPTION>
    <OPTION>ENCP004</OPTION>
    <OPTION>ENCP005</OPTION>
    <OPTION>ENCP006</OPTION>
    <OPTION>ENCP007</OPTION>
    <OPTION>ENCP008</OPTION>
    <OPTION>ENCP009</OPTION>
    <OPTION>ENCP010</OPTION>
    <OPTION>ENCP011</OPTION>
    <OPTION>ENCP012</OPTION>
    <OPTION>ENCP013</OPTION>
    <OPTION>ENCP016</OPTION>
</SELECT><P>
<BR>
<BR>

<Input = InputBox("Enter your message") name="input">


<BR>
<BR>
<Input Type = "Button" Name = "btn01" VALUE = "SUBMIT">
<Input Type = "Button" Name = "btn02" VALUE = "CLOSE">
<BR>
<BR>

</BODY>

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...