Network Popup Message

I am looking for a terminal code that will allow me to send a popup message to any mounted or other computer with an ip address on my network. About two years ago I was reading MacAddict magazine and I believe I found a write up on how to do the popup message. Can any on clear this up or point me in the right
Direction. Thanks

FW800 single 1.0, Mac OS X (10.2.x)

Posted on May 2, 2006 6:36 AM

Reply
30 replies

May 2, 2006 7:17 AM in response to rrd1281

The first thing that comes to my mind is Applescript, which can be executed from the terminal using the 'osascript' command. Here's an example:

osascript << eof</span>
tell application "Finder"
activate
display dialog "Hello World!"
end tell
eof
I tested the dialog by first, connecting to the remote computer via ssh:
ssh user@remote_computer.local
After typing the password, and I then typed in the osascript lines above. Alternatively, you can make a shell script containing the lines above and just execute that script.
I hope this helps.

May 2, 2006 12:29 PM in response to rrd1281

With a little additional work, you can do this using the built in smb fileserver.
In addition, beeing able to send and receive messages on your macintosh computers you also will be able to send and receive messages to any windows machine on your local network using the "net send" command on windows.

however, you have to make this modification on every machine before you can use it:

windows filesharing must be set to on on all machines which want to receive notifications
in /etc/smb.conf, look in the [global] section at the beginning. Before the start of the next section insert a line:
message command = /usr/local/bin/smbpopup %s %m ; rm %s

the smb daemon sends to arguments:
1) the file containing the message text
2) the netbios name of the computer which sent the message

Now create the smbpopup in the correct path:
#!/bin/sh
# log the event in the system.log
logger smbpopup: $1 $2
# get the text out of the message file
MSG=$( cat $1 )
# call program which actually displays the message
/usr/sbin/alert SMB Message_From$2: "$MSG"

do a chmod a+x to make it executable.

Finally you need the little "alert" program which displays the popup, and put in into /usr/sbin. I can send you a link where you can download it, if you want it.

If everything has been setup you can send a message with:
echo "my Message" | smbclient -M ip.of.the.pc

May 2, 2006 3:00 PM in response to rrd1281

Ok,
I try, this time more complete

open a Terminal, type:
sudo pico /etc/smb.conf
Hit enter, if asked for a password, type the password you use to login to your computer, password will not be echoed on the terminal, type blind. This might happen later again in other command where sudo is used.

pico is a simple editor, which comes with osx, there are better ones, but this one will do.

now, move to somewhere in the /etc/smb.conf [global] section with the keyboard and insert:
message command = /usr/local/bin/smbpopup %s %m ; rm %s
Save the file, press CTRL-X, confirm saving the changes.
You now should be back in the shell

just in case, if /usr/local and /usr/local/bin does not exist type:
sudo mkdir /usr/local
sudo mkdir /usr/local/bin

now, again start pico, this time with
sudo pico /usr/local/bin/smbpopup

Paste the following:
#!/bin/sh
# log the event in the system.log
logger smbpopup: $1 $2
# get the text out of the message file
MSG=$( cat $1 )
# call program which actually displays the message
/usr/sbin/alert SMB Message_From$2: "$MSG"
# end pasting...

Press CTRL-X, save the changes
do a chmod a+x to make it executable by:
sudo chmod a+x /usr/local/bin/smbpopup

download the "alert" program (to your desktop)
replace the "_" with "/" in the line below !
http: _www.biermann.org_philipp_OSXalert.tar.gz
CTRL-CLick the downloaded file, choose "open with BomArchiveHelper"
The archive is unpacked, and a file without an icon called "alert" appears on your desktop.

Again, in the terminal, do a:
sudo mv ~/Desktop/alert /usr/sbin
and a:
sudo chown root:wheel /usr/sbin/alert
and a:
sudo chmod u+s /usr/sbin/alert
Note, the program needs root permissions, otherwise, it cannot connect to the windowserver and therefore, it cannot display the popup - if you do not want to trust the program, make a backup of your files before using it - The sourcecode is availible, if you want to build it yourself.

Stop and Start the Windows filesharing in the system pref pane.

If everything has been setup you can send a message with:
echo "my Message" | smbclient -M ip.of.the.pc

May 4, 2006 5:08 AM in response to nobody loopback

I saved the first three lines and they went fine.

It will not alow me to write:

#!/bin/sh
# log the event in the system.log
logger smbpopup: $1 $2
# get the text out of the message file
MSG=$( cat $1 )
# call program which actually displays the message
/usr/sbin/alert SMB Message_From$2: "$MSG"
# end pasting...

I am in pico 2.5 File: /usr/local/bin/smbpopup
when i paste this.

That is were i stand now.

May 4, 2006 10:02 AM in response to nobody loopback

Nope. I pasted

sudo pico /usr/local/bin/smbpopup

and then pasted

#!/bin/sh
# log the event in the system.log
logger smbpopup: $1 $2
# get the text out of the message file
MSG=$( cat $1 )
# call program which actually displays the message
/usr/sbin/alert SMB Message_From$2: "$MSG"
# end pasting...

contol x to save and still get no write privileges.
Thanks for trying to get me though this. I hope i will be able to figure it out.

May 5, 2006 4:32 AM in response to nobody loopback

Great set all the commands. But when i send a message:

echo "my Message" | smbclient -M 202.180.22.89

This shows up:

rpi% echo "my Message" | smbclient -M 202.180.22.89
params.c:Parameter() - Ignoring badly formed line in configuration file: /usr/local/bin/smbpopup %s %m ; rm %s
params.c:Parameter() - Ignoring badly formed line in configuration file: sudo mkdir /usr/local
params.c:Parameter() - Ignoring badly formed line in configuration file: sudo mkdir /usr/local/bin
added interface ip=202.180.22.75 bcast=202.180.22.255 nmask=255.255.255.0
session request failed

May 5, 2006 2:15 PM in response to rrd1281

rdd:
You probably have put more then necessary in /etc/smb.conf !
looks like you have not only added one line:

message command = /usr/local/bin/smbpopup %s %m ; rm %s

but also the things, which either had to be entered in a terminal window or into /usr/local/smbpopup.

do a:
sudo pico /etc/smb.conf
and verify that only this has been added:
message command = /usr/local/bin/smbpopup %s %m ; rm %s


Again check the contents of:
/usr/local/bin/smbpopup

The minumum contents are:

#!/bin/sh
logger smbpopup: $1 $2
MSG=$( cat $1 )
/usr/sbin/alert SMB Message_From$2: "$MSG"

type:
cat /usr/local/bin/smbpopup

to verify it.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Network Popup Message

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.