PDA

View Full Version : Can I set schedule to pop up a message box



Stevenisme
3rd September 2005, 02:51 AM
If I want to popup a message box remind me to take my lecture acounting to some time,
is there a way to do so or I need to write my own code? :p

kosmosik
3rd September 2005, 03:21 AM
echo -e 'zenity --info --title="Reminder"\
--text="Do your goddamn homework boy"' | \
at today +3 minutes

will display you a message in three minutes from run... :)

% yum install zenity
% zenity --help
% man at
% cat $(rpm -ql at | grep timespec)

;]

tejas
3rd September 2005, 03:53 AM
Unfortunately, this will not Work

Zenity Will not be able to find yer display variable, and will silently fail.

Here is what I did instead:

Put this script in the file /home/user/bin/remind [or somewhere in the PATH]:
#!/bin/sh

#
# Program To Popup Messages after time $1;
# Syntax: remind <time> Message
# time is in: <time> from now
# ex: remind 10m "hi" <--- This says hi after 10 mins
# -Tejas Dinkar
#

sleep $1

shift 1
MESSAGE=${@:-"This is a Reminder"}

kdialog --sorry "$MESSAGE"

unset MESSAGEIf you are using GNOME, change the line

kdialog --sorry "$MESSAGE"
to
zenity --info --title="Reminder" --text="$MESSAGE"

To run it, press alt-f2 (run program)
and type in remind 5m "Message"

time can be in s, m, h, d
for sec min hour day

Stevenisme
3rd September 2005, 03:55 AM
Thx Kosmosik
zenity can just display some builded and fixed message box... ( I have tried some quite funny)
at run a command at some time
It is not fit my desir, some thing like zenity is good but I cannot type my own message..

Stevenisme
3rd September 2005, 04:04 AM
Thx tejas,
I got it.
also thx kosmosik the zenity is powerful


zenity --info --title="Reminder" --text="$MESSAGE"
combine with the shell script can do my wish :D :eek: :eek: Powerful