Address Book search and Skype from the command line

[Tweet : nvALT]

Here’s a neat little command-line utility for searching your address book: aboo. It’s not complex… it just takes a single word or phrase and searches your Address Book entries’ names for it. It can output vcards and YAML, too. I created a fork that adds a few things, most importantly I extended search to business names and notes. It also does a better job of realizing there’s no proper name and substituting the Company name in the output, if it exists. There’s a compiled binary of my fork on GitHub, too. Just put it in /usr/local/bin and run aboo -h to see the options.

So, I’m toying with that this morning and I get a sudden urge to be able to make a Skype phone call from the command line. I added a -p flag to aboo which only returns entries which have a phone number. A little awk on the output, and you can get a menu of people to send straight to a function that can call them with Skype. I’ll skip the middle part for now, but here’s a bash function for dialing a number. It accepts multiple formats of strings and tries to turn it into a standardized format for Skype (+15554321111). Usage: skype 5555551111 or skype "(555) 555 5124" (it will strip the extra characters, makes it easier to paste and dial quickly).

skype () {
  number=`echo $1|sed 's/[\(\)\+ \-]//g'|sed 's/^1//'|sed 's/^/+1/'`
  osascript -e "tell application \"Skype\" to send command \"CALL $number\" script name \"CLIDIALER\""

I normally make most of my Skype calls from LaunchBar, but this will come in handy every once in a while when I’m already working in Terminal. Thought it might be handy for someone else, too.

Ryan Irelan has produced a series of shell trick videos based on posts. Readers can get 10% off using the coupon code TERPSTRA.