Hack30.Skype People from the OS X Address Book


Hack 30. Skype People from the OS X Address Book

Using AppleScript and the Mac OS X Address Book, you can Skype any phone number in your address book with two mouse clicks.

Though the Skype API provides some power tools for Skype hackers on the Mac, you can do quite a bit with Skype using plain-old AppleScript. This is great, since not all hackers prefer the same tools (or, if you're like me, you've stubbornly refused to understand C). In "Skype Your Outlook Contacts" [Hack #29], you saw a few different ways to tie Windows-based Outlook to Skype. You can do the same thing for the Mac OS X Address Book with a little bit of assistance from trusty old AppleScript.

Thanks to the simple but awesome script shown in the next section, it's a snap to call any of your Mac OS X Address Book contacts using Skype.

3.4.1. The Code

For starters, you'll want to key the following script into the AppleScript Editor. You can find the AppleScript Editor in your Mac's Applications folder:

 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 x to value of e as string if character 1 of x is not "+" then set x to "+1" & x end if set SKYPEurl to "callto://" & x tell application "Skype" get URL SKYPEurl activate end tell return true end perform action end using terms from 

3.4.2. Running the Code

In the AppleScript Editor, save this code as an AppleScript in your user's Library/Address Book Add-ins folder. Then, fire up the OS X Address Book and find a contact with a phone number, as shown in Figure 3-3.

Figure 3-3. The Mac OS X Address Book


Now, right-click (or Ctrl-click) the contact's phone number. The contextual menu should contain an option labeled Call with Skype if you've done everything correctly up until this point. Clicking that option will cause Skype to attempt a call to the phone number in the contact record. Note that you'll need to have SkypeOut credit to call a PSTN phone number using Skype.

Remember those Skype pay services I mentioned at the beginning of this chapter? SkypeOut is one of them. It lets you call old-fashioned phone numbers from your Skype client for just a few cents a minute. You can buy minutes ahead of time from http://www.skype.com/.


Even though the Address Book's phone fields are referred to as numeric in nature throughout the Address Book AppleScript documentation, you can enter alphanumeric values for any phone field. So, if you want to Skype somebody from your address book using their Skype name rather than their PSTN phone number, just enter their Skype name into a phone number field in the Address Book. That will work just fine.




VoIP Hacks
VoIP Hacks: Tips & Tools for Internet Telephony
ISBN: 0596101333
EAN: 2147483647
Year: 2005
Pages: 156

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net