Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'laundry reminder' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
laundry reminder
Authored by: Thom on Jun 19, '03 01:37:31AM
I wrote the following in order to remind myself of laundry, etc.
It's a 'nag me in N minutes with message M' sort of deal.

With the exception of the control-D's below, you should be able to cut and paste pretty easily, and it'll work (provided you've got a ~/Library/init/tcsh directory and a ~/bin that's in your $PATH).

If you don't have ~/bin or init/tcsh set up, you may want to consult this hint.


cat > ~/bin/speak_reminder
#!/bin/zsh
time=$1; shift; message="$@";
`sleep $(( 60 * $time )); osascript -e "say \"$message\"";`
^d (hit control + d to stop dumping into the file)

chmod 755 ~/bin/speak_reminder

rehash

cat >> ~/Library/init/tcsh/aliases.mine
alias laundry 'speak_reminder \!^ laundry done &'
^d (Again with the control-d)

source ~/Library/init/tcsh/aliases.mine

laundry 5


The first piece, speak_reminder, is used like
speak_reminder 5 blah blah blah blah
where the first argument is how many minutes to wait, and the remainder of the line is what to say.

As others have suggested, there are other things to do with AppleScript, such as putting up a dialogue box with an 'OK' button, so in case you don't hear the speech, you would still see the box on the screen, etc.

The usage of the second piece, the 'laundry' alias, is shown -- laundry N -- where N is how many minutes to wait before saying the 'laundry done' message.

Note that in the alias 'laundry' (in tcsh) I'm using !^ to insert the command line the user types in the middle of the alias. I'm also using & at the end of the line to 'background' the job so I get my prompt back immediately.

I like this setup better than some of the ones I've seen before on here because the script is generic, but you can make as many aliases to it as you want, which could either have predefined times, messages, or both.

Have fun -- I have to go put my laundry in the dryer.

Thom

[ Reply to This | # ]