You are not logged in.
Hi,
I am using this script to count new gmail messages
checkgmail.sh
#!/bin/bash
gmail_login="myusername"
gmail_password="mypass"
nbmail="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - \
https://${gmail_login}:${gmail_password}@mail.google.com/mail/feed/atom \
--no-check-certificate | grep 'fullcount' \
| sed -e 's/.*<fullcount>//;s/<\/fullcount>.*//' 2>/dev/null)"
if [ -z "$nbmail" ]; then
echo "error"
else
echo "$nbmail message(s)"
fi
This is the gmail part from .conkyrc
#check for new gmail exery 120sec
TEXT
Gmail: ${execi 120 sh ~/Downloads/backup/checkgmail.sh}
How can I make it play a .wav file when there is a new message?
I am new at scripts and all. Can I change this in checkgmail.sh? It doesn't work. Why?
if [ -z "$nbmail" ]; then
echo "error"
aplay ~/sounds/error.wav
else
echo "$nbmail message(s)"
aplay ~/sounds/mail_here.wav
fi
The command "aplay ~/sounds/mail_here.wav" works in terminal
Last edited by Ventil1 (2010-03-19 12:48:34)
Offline
Fixed it! Counts gmail messages, diplays the number of messages and plays a sound if there are more then 0.
I am glad some basic java and C stuff from college finally paid up
#!/bin/bash
gmail_login="myusername"
gmail_password="mypass"
nbmail="$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - \
https://${gmail_login}:${gmail_password}@mail.google.com/mail/feed/atom \
--no-check-certificate | grep 'fullcount' \
| sed -e 's/.*<fullcount>//;s/<\/fullcount>.*//' 2>/dev/null)"
if [ -z "$nbmail" ]; then
echo "Error"
else
if [ $nbmail != 0 ]; then
echo "$nbmail message(s)"
aplay ~/sounds/mail_here.wav
else
echo "$nbmail message(s)"
fi
fi
Last edited by Ventil1 (2010-03-19 12:50:14)
Offline
if [ -z "$nbmail" ]; then
echo "Error"
else
if [ $nbmail != 0 ]; then
aplay ~/sounds/mail_here.wav
fi
echo "$nbmail message(s)"
fi
[/pedantic]
I'm curious though, did you find out why the aplay command didn't work in the original version?
Offline
The path to the file in my script was wrong.
Offline