[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: procmail script question



On Sun, Jul 22, 2001 at 02:43:30PM -0700, Lang Hurst wrote:
> I use the following procmail script to make festival speak the FROM and SUBJECT headings of new email through my speakers:
> 
> SUBJECT=`formail -xSubject: \
> | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
> SENDER=`formail -xFrom: \
> | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
> :0c
> | echo "New mail from " $SENDER ". the subject is " $SUBJECT | festival --tts
> 
> That works great.  However I am often listening to my vorbis collection.  When my music is playing and a new email comes in, the festival output just gets garbled with the music.  I would like to set up a procmail script that says
> 
> if xmms is playing:
> 	xmms -u #pause xmms
> 
> process new email
> 
> if xmms was playing:
> 	xmms -p #start playing again
> 
> I just don't know how to test for a process, and the two books I have on the subject are too basic, or I'm missing the page.  Any help appreciated.

This is a little ugly, but it should work:

   :0
   | pid=`ps -ef | grep ^$USER | grep -v grep | grep xmms`; \
       if [ "X$pid" != "X" ]; then echo ... | festival --tts; fi

Fill in the ... with the whole echo command above, of course. $USER
should be your user name, if it's not already set.

-- 
John Patton                      patton66@home.com

"It is dangerous to be right in matters on which the established
authorities a wrong." -Voltaire



Reply to: