I caught this Ruby Inside post about using ruby as an applescript replacement earlier today, and started reading the associated links, and searching for something I could try to do with ruby and applescript that might actually make my life a little easier.
Thanks to my friend Dave, I’ve been giving twitter a 2nd chance. So, I created a tiny script to let me tweet from the command line. It’ll either take arguments and use them as the input, or standard input. I’m sure I could have done it without using applescript or the wonderful Twitterrific, but that wouldn’t have been as much fun. This way I get Twitterrific’s niceties, and besides I always have it running anyway.
#!/usr/bin/env ruby
require 'rubygems'
require 'appscript'
str = ARGV.join(" ")
if str.length == 0
$stdin.each {|l| str << l}
end
Appscript.app('Twitterrific').post_update(str[0..139])
Usage:
jro@fireant:~$ tweet Having a great old time jro@fireant:~$ tweet @someone that sounds like fun! jro@fireant:~$ uptime | tweet
