Use Skype with Address Book and/or Butler

Jul 20, '06 07:30:00AM

Contributed by: flowbike

Do you use Skype for telephone calls from Mac to Mac or from Mac to phone? Than this hint brings some cool news to you. With a liitle help from AppleScript, you can call your contacts from within your Address Book application. If you use Butler, you can also use this for getting fast access to your phone numbers or Skype contacts.

First let's discuss the Address Book/AppleScript solution. Open Script Editor, and create this simple AppleScript. (Note that you can also download the script if you prefer.)

using terms from application "Address Book"
  on action property
    return "phone"
  end action property
  
  on action title for p with e
    return "Call with Skype"
  end action title
  
  on should enable action for p with e
    return true
  end should enable action
  
  on perform action for p with e
    
    set SKYPEurl to "callto://" & (value of e as string)
    tell application "Skype"
      get URL SKYPEurl
      activate
    end tell
    return true
  end perform action
end using terms from
Save the script (call it Skype or whatever you like), and then (quit Address Book first), move it into your user's Library -> Address Book Plug-Ins. Now launch Address Book, and you'll have new contextual menu items on the phone numbers. You can also make a new label for a phone number and name it, for example, Skype, and then type in the Skypename of your contact.

The two new contextual menu options are Dial with Skype, which you use for dialing numbers with Skypeout, and Call with Skyp, for using Skypenames for phoning from Mac to Mac or PC.

If you want to use Butler for fast access to your Skypecontacts, here's how. Open Butler's Preferences panel, and go to the Abbreviation section. In the window in the lower section, you see some code for an AppleScript made to use with a phone tool other than Skype. Replace that code with this:
--name: call with skype

to switchText from t to r instead of s
  set d to text item delimiters
  set text item delimiters to s
  set t to t's text items
  set text item delimiters to r
  tell t to set t to item 1 & ({""} & rest)
  set text item delimiters to d
  get t
end switchText

try
  set theNumber to "[NUMBER]"
  set theNumber to switchText from theNumber to "" instead of " "
  set theNumber to switchText from theNumber to "" instead of "("
  set theNumber to switchText from theNumber to "" instead of ")"
  set theNumber to switchText from theNumber to "" instead of "/"
  set theNumber to switchText from theNumber to "" instead of "-"
  set theCommand to "CALL " & theNumber
  tell application "Skype"
    send command theCommand script name "butlercall"
  end tell
  set theResult to "[SUCCESS]"
on error
  set theResult to "[ERROR]"
end try
get theResult
It doesn't matter write your phone numbers; they can include +, -, (, ), or blanks. Only slashes cause problems. You can also set hot keys to phone numbers in Butler for real quick access.

Ok, so maybe you think: "why don't you just import your addresses from Address Book to Skype?" The answer is that this way, you only have one place where you store your data, so you never have to wonder "which number is the right one?" Thanks to Peter Maurer for the great support, making this possible.

[robg adds: I tried both methods, and both worked great. The only caveat is that, in the USA at least, to use Skype Out to call land lines, the phone numbers in Address Book must be stored with a "+" at the front, like this: +1-303-555-1212. Once I formatted some of my numbers in this way, they all worked great with the scripts. Nifty!]

Comments (10)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20060718114236477