Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Popup Message on intranet 1

Status
Not open for further replies.

TommyF

Technical User
Oct 28, 2001
104
I have a very basic intranet system running at work which displayes the running order of our machines and I want to know if it is possiable to send a html popup message to certain users for example if the running order has changed. I don't want the users to have any interaction apart from closing the message.

Can anybody point me in the right direction please.

 
Thanks for your help palbano. I have found some code using net send and it works fine. At the moment it sends a message to winpopup is there anyway it can popup the message in a html page or something like that?

This is my code so far that uses winpopup.

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<%@ LANGUAGE = VBScript %>

<%
' Sending a message using NET SEND on a Windows NT network
' (C)opyright 2001 - Robin Paardekam
' Nice script to embed on your intranet. Send a message to any user
' on a network using your browser (!)
' More scripts like this can be found at
'Checking for all necessary variables.
Msg = TRIM(Request.Form(&quot;Msg&quot;))
NamUsr = TRIM(Request.Form(&quot;NamUsr&quot;))
Computer = Request.ServerVariables(&quot;REMOTE_ADDR&quot;)

if Msg <> &quot;&quot; AND NamUsr <> &quot;&quot; THEN
'Sending the message
Response.Write &quot;<P>Sending message to &quot;
Response.Write &quot;<B>&quot; & NamUsr & &quot;</B>: &quot;
Response.Write Msg & &quot;</P>&quot;
Set server_shell = Server.CreateObject(&quot;wscript.shell&quot;)
server_shell.Run &quot;%comspec% /c net send &quot; & NamUsr & &quot; [FROM:&quot; & Computer & &quot;] &quot; & Msg

ELSE
'Displaying the form %>
<FORM NAME=&quot;Vorm&quot; METHOD=&quot;Post&quot;>
To: <INPUT TYPE=&quot;text&quot; NAME=&quot;NamUsr&quot; SIZE=&quot;20&quot;><BR>
Message: <INPUT TYPE=&quot;text&quot; NAME=&quot;Msg&quot; SIZE=&quot;40&quot;><BR>
<INPUT TYPE=&quot;submit&quot; VALUE=&quot;Send Message&quot;>
</FORM>
<% END IF
%>
</body>
</html>

Thanks again
 
This script is really cool :)

How can one set it up so I can have a drop down of names which I could use to send to??

 
I have just come across a problem with this script, When you send messages from any pc using this scrpit the from person is always the pc with the website on it.

lengoo did you find this?
 
Thats because this is an NT messaging system that sends a message from wherever it is executed to wherever you want to send it. The only way your going to be able to popup a message to someone inside their web page is if
a) They already are on your site
and
b) If they refresh the page occasionally or request a new page

What you could then do is have a check at the top of each page to see if any messages are pending, then show them the messge is there is one and remove it from your message queue. One way to make sure they are sending constant refreshes would be to put a small hidden iframe somewhere in the page that refreshes every 10 seconds or so using javascript. The page it refreshes could just check for messages, if it finds one for this user than it could call a javascript function in the parent page with the content of the message and the javascript function could display it.

-Tarwn [sub]01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101 [/sub]
[sup]29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19[/sup]
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Tarwn thanks for your help that does sound a better way to do it.

For the moment I have just changed the code I had so instead of the IP address it tells me the name. This is not a problem for me as I am only using it with a couple of users.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#000000&quot; text=&quot;#FFFFFF&quot;>
<%@ LANGUAGE = VBScript %>
<%
' Sending a message using NET SEND on a Windows NT network
' (C)opyright 2001 - Robin Paardekam
' Nice script to embed on your intranet. Send a message to any user
' on a network using your browser (!)
' More scripts like this can be found at
'Checking for all necessary variables.
Msg = TRIM(Request.Form(&quot;Msg&quot;))
NamUsr = TRIM(Request.Form(&quot;NamUsr&quot;))
Computer = Request.ServerVariables(&quot;REMOTE_ADDR&quot;)
if computer= &quot;10.0.0.72&quot; then user= &quot;User1&quot;
if computer= &quot;10.0.0.13&quot; then user = &quot;User2&quot;
if computer =&quot;10.0.0.154&quot; then user = &quot;user3&quot;

if Msg <> &quot;&quot; AND NamUsr <> &quot;&quot; THEN
'Sending the message
Response.Write &quot;<P>Sending message to &quot;
Response.Write &quot;<B>&quot; & NamUsr & &quot;</B>: &quot;
Response.Write Msg & &quot;</P>&quot;
Set server_shell = Server.CreateObject(&quot;wscript.shell&quot;)
server_shell.Run &quot;%comspec% /c net send &quot; & NamUsr & &quot; [FROM:&quot; & user & &quot;] &quot; & Msg

ELSE
'Displaying the form %>
<p>&nbsp;</p>
<p align=&quot;center&quot;><font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;7&quot;><b>SEND MESSAGE</b></font></p>
<p align=&quot;center&quot;>&nbsp;</p>
<p align=&quot;center&quot;><img src=&quot;images/email_computer-ani.gif&quot; width=&quot;107&quot; height=&quot;35&quot;></p>
<p>&nbsp;</p>
<FORM NAME=&quot;Vorm&quot; METHOD=&quot;Post&quot;>
<div align=&quot;center&quot;>
<p><font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;5&quot;>To:</font>
<INPUT TYPE=&quot;text&quot; NAME=&quot;NamUsr&quot; SIZE=&quot;30&quot;>
(Thomas,Unit25 Or Warehouse)</p>
<p><BR>
<font size=&quot;5&quot; face=&quot;Arial, Helvetica, sans-serif&quot;>Message: </font>
<input type=&quot;text&quot; name=&quot;Msg&quot; size=&quot;60&quot; value=&quot;&quot;>
</p>
<p><BR>
<INPUT TYPE=&quot;submit&quot; VALUE=&quot;Send Message&quot;>
</p>
</div>
</FORM>
<% END IF
%>
</body>
</html>
 
TommyF,
Any idea on how to get it working so that you have a drop down list of users you can send to rather than having to remember the machine name?

Thanks
 
lengoo

The only way I think you could do this is by populating the dropdown list from a database. I went to the following website and did a search on drop down list and it came up with some good results. You will probable have to pick one that is good for you and try and fit it into the code we already have.


Sorry for not being to much help but I am very new to ASP.

I will try as well and see what we come up with

tommyf
 
Tommyf,
YOu're new to ASP??? I was really impressed with your little script though!
 
lengoo thanks but I must say I did not right it I got it of the website I gave you I have just changed it a little for my own use.
 
I have found another way as but it depends how many users you have. I have removed the text box and added a drop down box.

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#000000&quot; text=&quot;#FFFFFF&quot;>
<%@ LANGUAGE = VBScript %>
<%
' Sending a message using NET SEND on a Windows NT network
' (C)opyright 2001 - Robin Paardekam
' Nice script to embed on your intranet. Send a message to any user
' on a network using your browser (!)
' More scripts like this can be found at
'Checking for all necessary variables.
Msg = TRIM(Request.Form(&quot;Msg&quot;))
NamUsr = TRIM(Request.Form(&quot;NamUsr&quot;))
Computer = Request.ServerVariables(&quot;REMOTE_ADDR&quot;)
if computer= &quot;10.0.0.72&quot; then user= &quot;User1&quot;
if computer= &quot;10.0.0.13&quot; then user = &quot;User2&quot;
if computer =&quot;10.0.0.154&quot; then user = &quot;user3&quot;

if Msg <> &quot;&quot; AND NamUsr <> &quot;&quot; THEN
'Sending the message
Response.Write &quot;<P>Sending message to &quot;
Response.Write &quot;<B>&quot; & NamUsr & &quot;</B>: &quot;
Response.Write Msg & &quot;</P>&quot;
Set server_shell = Server.CreateObject(&quot;wscript.shell&quot;)
server_shell.Run &quot;%comspec% /c net send &quot; & NamUsr & &quot; [FROM:&quot; & user & &quot;] &quot; & Msg

ELSE
'Displaying the form %>
<p> </p>
<p align=&quot;center&quot;><font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;7&quot;><b>SEND MESSAGE</b></font></p>
<p align=&quot;center&quot;> </p>
<p align=&quot;center&quot;><img src=&quot;images/email_computer-ani.gif&quot; width=&quot;107&quot; height=&quot;35&quot;></p>
<p> </p>
<FORM NAME=&quot;Vorm&quot; METHOD=&quot;Post&quot;>
<div align=&quot;center&quot;>
<p><font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;5&quot;>To:</font>

'ADD THIS SECTION INSTEAD OF THE TEXT BOX

<select name=&quot;NamUsr&quot;>
<option selected>USER1</option>
<option>USER2</option>
<option>USER3</option>
</select>
</p>
<p><BR>
<font size=&quot;5&quot; face=&quot;Arial, Helvetica, sans-serif&quot;>Message: </font>
<input type=&quot;text&quot; name=&quot;Msg&quot; size=&quot;60&quot; value=&quot;&quot;>
</p>
<p><BR>
<INPUT TYPE=&quot;submit&quot; VALUE=&quot;Send Message&quot;>
</p>
</div>
</FORM>
<% END IF
%>
</body>
</html>

I have not tried it but I would think you could put in the persons name and do an if statement to change it to the machine name to send.
 
Nice little script - may solve teh shouting from downstairs to upstairs between me and my wife :)

I can get setn send to run from DOS, but get a permission denied error on the line

server_shell.Run &quot;%comspec% /c net send &quot; & NamUsr & &quot; [FROM:&quot; & user & &quot;] &quot; & Msg

Any ideas?

Yes, I am logged on as an administrator.


Steve Davis
hey.you@hahaha.com.au

Me? I can't even spell ASP!
 
Microbe

I don't think you will get this to run from Dos it is really a Win NT/2K/xp script. The only way I could get it to work on win 9x machines was to have winpopup or a similar program loaded on them.

Why do you want to run it from DOS?
 
Sorry, you misunderstood me...

When I try to run the script in my browser, I get a permission denied error.

So I tried just doing net send (IP#) message at the DOS prompt and it worked.

Does anyone have any idea what permissions have to be reset so it will run in a browser?

I repleat, I am logged in as an Administrator - WinXP Pro

Actually this may be, and looks like, a likely candidate for my first Visual Basic project.

Steve Davis
hey.you@hahaha.com.au

Me? I can't even spell ASP!
 
Microbe sorry I misunderstood you. Is the other PC set up as a user on you XP machine and vice versa? If you can send a message using the IP address from Dos then it just can't figure out the user name. Can you send a message from the browser if you put an IP address instead of a user name?


I don't think the permissions will be the problem as I can get it to send from a machine with a guest logon to anthoer pc.

tommyf

 
Microbe I just had a thought and I just want to check that you have you XP Pro machine set up as a webserver and that you have saved the above code as a .asp file.

I know it might sound an obvious question but we just need to rule out everything for me to get it to work for you.
 
lol...thanks for checking, sometimes it pays to ask the obvious questions.

Yes, it is running IIS. I am pretty experienced ASP programmer, so it is not any of those sort of things.

Error Type:
Microsoft VBScript runtime (0x800A0046)
Permission denied
send.asp, line 29

Line 29: server_shell.Run &quot;net send 192.168.0.1 [FROM:me] test&quot;


And I do appreciate your help...


Steve Davis
hey.you@hahaha.com.au

Me? I can't even spell ASP!
 
Microbe I have been looking on the web about the error message you had and I it looks like it is down to the logon.

I have found some information but you may have already checked this


Sorry if I am not much help but I am very new to asp and VB and am just trying to pick this up as I go.

tommyf

PS could you point me in a good direction of some good books to help me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top