Submitted By: Anonymous Submission

Creates a graphical user interface for the Net Send command.

Visual Basic
Edit|Remove
<html>
<head>
<hta:application
	id="myNetsend"
	applicationname="myNetsend"
	border="thin"
	borderstyle="normal"
	caption="yes"
	sysmenu="yes"
	maximizeButton="no"
	scroll="no"
	selection="no"
	icon="explorer.exe"
	version="V057"
	creation="03NOV2005"
	update="13JAN2006"
	author="Delrinian"
/>
<title>Net Send</title>

<script type="text/VBScript">
	public g_strRepeat, g_strOnline, g_strSender, g_strThisUser
	Set objNetwork = CreateObject("WScript.Network")
	g_strThisUser = UCase(objNetwork.UserName)
	Window.ResizeTo 480,320

	Function NetSend(strSID)
		If not strSID = "" Then
			If not strText.value = "" Then
				Dim objShell, iReturn
				Set objShell=CreateObject("WScript.Shell")
				strMyText = Replace(strText.value, vbCrLf, ", ")
				strMyText = Replace(strMyText, chr(34), "'") 
				strMyText = chr(34) & strMyText & chr(34)
				iReturn=objShell.Run("%comspec% /c net send " & strSID & " " & g_strThisUser & " says: " & strMyText,0,true)
				g_strRepeat=strText.value
				If not iReturn = 0 Then
					if g_strOnline = "OFFLINE" Then
						x.style.backgroundColor="#FFFF00"
						strText.innerHTML="ERROR: The message has not been sent," &_
						" it seems the user is not online or does not exist."
						Msg.innerHTML="ERROR:"
					End If
				Else
					x.style.backgroundColor="#00FF00"
					strText.innerHTML=""
					Msg.innerHTML="Message sent."
				End If
			Else
				x.style.backgroundColor="#FFFF00"
				strText.innerHTML="ERROR: There was nothing to be sent," &_
				" please type something in this box to send."
				Msg.innerHTML="ERROR:"
			End If
		Else
			x.style.backgroundColor="#FFFF00"
			strText.innerHTML = "ERROR: Who are we sending this to?"
			Msg.innerHTML = "ERROR:"
		End If
	End Function

	Function Repeat()
		strText.innerHTML=g_strRepeat
		Msg.innerHTML="Here is your last message."
	End Function

	Function Clear()
		strText.innerHTML=""
		Msg.innerHTML="Ready."
	End Function

	Function Check(strSID)
		If not strSID = "" Then
			Dim objShell, iReturn, strHTML
			strHTML=""""
			Set objShell=CreateObject("WScript.Shell")
			iReturn=ObjShell.Run("%comspec% /c net send " & strSID & " " & strHTML,0,true)
			If not iReturn = 0 Then
				Msg.innerHTML=UCase(strSID) & " is OFFLINE"
				x.style.backgroundColor="#FF0000"
				strText.innerHTML=""
				g_strOnline="OFFLINE"
			Else
				Msg.innerHTML=UCase(strSID) & " is ONLINE"
				x.style.backgroundColor="#00FF00"
				strText.innerHTML=""
				g_strOnline="ONLINE"
			End If
		End If
	End Function

	Function Return()
		strText.focus
	End Function		
</script>
</head>
<body>
<div id=wrapper>
	<div class="header"><span id="head1">net</span><span id="head2">send</span>
	<span id="head3"><script>head3.innerHTML=myNetsend.version</script></span></div>
	<div>
		<p>To :: <input id="strSID" class="box" type="text" maxlength="15" onBlur="Check(strSID.value)">
		<span id="x" class="box"></span>:::::::::::::::::::::</p>
		<p>Message ::</br>
		<textarea id="strText" class="box" cols="40" rows="3"></textarea><br>
		<span class="message" id="Msg">Type your message above.</span></p>
		<p>
			<a href="#" onClick="NetSend(strSID.value)" onMouseUp="Return()" title="Sends the message to the user">Send</a>&nbsp;
			<a href="#" onClick="Repeat()" onMouseUp="Return()" title="Fills in the textbox with your last message">Repeat</a>&nbsp;
			<a href="#" onClick="Clear()" onMouseUp="Return()" title="Clears the textbox area">Clear</a>
		</p>
	</div>
	<div id="footer" title="Author: http://www.delrinian.com">&copy;&nbsp;delrinian</div>
</div>
</body>
</html>