A Mail.app AppleScript Rule Action
I often forward email messages along to Valerie, but I usually clean the noise out of them first—a process of just enough repetitive clicking and typing to make me want to write some code. (Hey, who are we if we don’t play?)
So, following the examples in /Library/Scripts/Mail Scripts/Rule Actions and with a little help from Mail Act-On, now I just have to hit ⌃V:
using terms from application "Mail"
on perform mail action with messages theMessages
tell application "Mail"
repeat with eachMessage in theMessages
set valeriesCopyOfEachMessage to make new outgoing message
tell valeriesCopyOfEachMessage
make new to recipient at end of to recipients with properties {name:"Valerie Todd", address:"valerie@amanikids.org"}
set subject to "From " & (extract name from sender of eachMessage) & " -- " & subject of eachMessage
set content to content of eachMessage
set visible to true
end tell
end repeat
end tell
end perform mail action with messages
end using terms from
Dumb geek tricks.
Rake::StakeoutTask
I’ve been writing a bunch of rdoc lately, and ⌘S/⌃⇧R/↩/⌘W/⌘⇥/⌘R was starting to get pretty cumbersome. (That’s rake rerdoc from TextMate, close the output window, switch to Safari and reload.)
So, I remembered and downloaded Mike Clark’s stakeout.rb, and now I’m down to ⌘S/⌘⇥/⌘R—not bad!
Except I was a little troubled by the packaging, so I threw together a new RubyGem, adding in Growl support along the way:
Think of it as a poor-man’s autotest, without being tied to testing.
Installation and Usage
svn co http://matthewtodd.org/svn/public/rake-stakeout cd rake-stakeout rake gem sudo gem install pkg/*.gem
require 'rake/stakeouttask' Rake::StakeoutTask.new(:stakeout_rdoc) do |stakeout| stakeout.stakeout_files = FileList['README', 'lib/**/*.rb'] stakeout.stakeout_task = :rerdoc stakeout.notification_method = :growl end
rake stakeout_rdoc
Have fun! I’d love to hear if you decide to give this a try.
Unix geek bathes in warm water
So I don’t burden my poor brain trying to remember stuff, I’ve rigged up some crontab entries that fire off Growl reminder messages every so often:
Arguably, I could have just put a bunch of event reminders in iCal, but it’s nice to avoid cluttering the calendar and I like the way these Growl notifications look. :)
crontab
The crontab file is an old-school unixy configuration file on the Mac (and many other platforms) that expresses a schedule of recurring tasks.
For what it’s worth, here’s mine:
matthew-todds-computer:~ mtodd$ crontab -l MAILTO='' 15 10,14 * * 1-5 /usr/local/bin/remind 'Take a minute to pray for Valerie and our marriage.' 0 16 * * 1-5 /usr/local/bin/remind 'Open the gate for Valerie if she honks.' 30 16 * * 1-5 /usr/local/bin/remind 'Now would be a great time to turn on the water heater.'
(The schedule information is a little cryptic—the last line makes sure I turn on the water heater every weekday (1-5) at 4:30pm.)
remind
Here’s the remind script, just a simple wrapper around growlnotify:
matthew-todds-computer:~ mtodd$ cat /usr/local/bin/remind #!/bin/sh /opt/local/bin/growlnotify \\ --appIcon iCal \\ --message "$*" \\ --sticky \\ --title 'Just a reminder'



