[comp.sys.next] Printer power on-off --- Announce mail arrival.

tvz@phoenix.Princeton.EDU (Timothy Van Zandt) (01/25/91)

It was previously mentioned in this newsgroup that the command
nppower can be used to turn the Next printer on and off, and
that the printer automatically powers back on the next time
something is printed.

I have two more bits of information and a question:

The application /NextAdmin/PrinterTester also has a power switch.
nppower is faster if a terminal window is already open, and only
nppower can be used when logged in remotely from a VT100 terminal.

It is possible to keep the Next printer from powering up during
startup by commenting out the line in the /etc/rc script that initiates
the Next Printer daemon /usr/lib/NextPrinter/npd. However, this
daemon must then be started from a terminal before any applications can
print.

Now the question: Does anyone now how to have the printer power up
automatically (without first issuing a command from a window) the first
time something is printed, rather than during startup?

Also, two questions about Mail: How can I get mail to make a sound
to announce the arrival of mail? How can I get the Mail Icon to show
that there is mail only when Active.mbox has mail, rather than also
when there is mail stored is another mailbox?

Suggestions mailed to tvz@princeton.edu would be greatly appreciated.

Tim

fuchs@czar.Princeton.EDU (Ira Fuchs) (01/26/91)

The easiest way I know of to have audio announcement of mail arrival is to
create a .forward file (or append to an existing one) the following:
"|sndplay soundofyourchoice.snd". You can actually take this a step
further and do something like this:
"|gawk '/anystringyoulike/ {system(\"sndplay somesound.snd\")}`"
This will play somesound.snd only when the string "anystringofyourchoice"
is in the mail. Obviously you can have as complex a gawk script as you like
(e.g., play the pre-recorded name of the sender or a tune which you
associate with the sender, etc.). The possibilities are endless (and
possibly noisy).

eps@toaster.SFSU.EDU (Eric P. Scott) (01/27/91)

In article <5705@idunno.Princeton.EDU> fuchs@czar.Princeton.EDU
	(Ira Fuchs) writes:
>The easiest way I know of to have audio announcement of mail arrival is to
>create a .forward file (or append to an existing one) the following:
>"|sndplay soundofyourchoice.snd".

A couple of people did this here (under 1.0--before
PublicSoundServer) on shared/laboratory network machines.
Needless to say, the novelty wore off very quickly, and we asked
them to modify this to check for console login first (or else).

					-=EPS=-

scott@sage.uchicago.edu (Scott Deerwester) (01/29/91)

To try to staunch the flow of email requests on how you do this,
here's how to get the NeXT to play a user-specific sound bite when
mail from that user arrives.  I think I remember getting this from
Steve somebody at UIUC from this news group.  

[Do we have a FAQ file in this news group?  Can somebody remind me why
Fontographer- generated PostScript fonts don't work and how to fix
it?]

First, edit or create a .forward file that looks like this:

--- CUT HERE ---
scott@sage.uchicago.edu, |/Users/scott/Apps/newmail
--- END ---

modified, of course.  Next, edit the following with the correct
directory:

---- CUT HERE ---
#!/bin/sh

DIR=/Users/scott/Sounds

if test -f /usr/bin/sndplay -a -r /dev/console
then
  from=` /usr/ucb/grep -i  '^From:' |
	 /usr/bin/tr 'A-Z' 'a-z' | /usr/ucb/head -1 |
	 /bin/sed '
		s/[^ ]* //
		s/.*<//
		s/>.*//
		s/([^)]*)//
		s/[@%].*//
		s/ .*//
	`
  if test "$from" != "" -a -r $DIR/$from".snd" ; then
    /usr/bin/sndplay $DIR/$from".snd"
  else
    /usr/bin/sndplay $DIR/mail.snd
  fi
fi
exit 0
--- END ---

Make it executable and put it in your Apps directory.  Then start
recording sound bites.  Some advice on sound bites; record one that
you'll get when it's from somebody you don't know and name it
mail.snd.  Mine says "Pssst!".  You could also record
mailer-daemon.snd, which will get played when your mail gets bounced.
I've got sound bites for a total of 35 logins.  You want to be a
little careful about your sound bites.  You'll hear these a lot.

Eric Scott's point that you only want to have this happen if you're
logged in is certainly valid.  The "test ... -r /dev/console" means
that this will only happen if you're logged in on the console.

I suppose that you could also shut it up by doing something like:

  if test -f $DIR/.quiet ; then
    echo 
  elif test "$from" != "" -a -r $DIR/$from".snd" ; then
    /usr/bin/sndplay $DIR/$from".snd"
  else
    /usr/bin/sndplay $DIR/mail.snd
  fi
--
Scott Deerwester            | Internet: scott@tira.uchicago.edu  | ~{P;N,5B~}
Center for Information and  | Phone:    312-702-6948             |
   Language Studies         | 1100 E. 57th, CILS                 |
University of Chicago       | Chicago, IL 60637                  |