Description: A script that make it possible to call a phone number from the Address Book directly with Skype.
Requirement: Mac OS 10.3.x and Skype
(* A script that make it possible to call a phone number from the Address Book directly with Skype. http://www.macosxhints.com/article.php?story=20041227175059613 http://forum.skype.com/viewtopic.php?t=7733 http://homepage.mac.com/bertlmike/skype.zip 2004-12-30 by Fredrik Jonsson <mailto(colon)fredrik(at)combonet(dot)se> home page <http://xdeb.org/wiki/AppleScript> *) using terms from application "Address Book" on action property return "phone" end action property on action title for aPerson with aPhone return "Call with Skype" end action title on should enable action for aPerson with aPhone return true end should enable action on perform action for aPerson with aPhone set phone_num to value of aPhone as string -- Clean up the phone number set phone_num to my austauschen("(", "", phone_num) set phone_num to my austauschen(")", "", phone_num) set phone_num to my austauschen("-", "", phone_num) set phone_num to my austauschen(" ", "", phone_num) if character 1 of phone_num is not "+" then if character 1 of phone_num is "0" then set character_count to the number of characters of the phone_num set phone_num to (characters 2 thru (the character_count) of the phone_num) as string end if if ((country of address 1 of aPerson) = "Sweden") or ¬ ((country of address 1 of aPerson) = "Sverige") or ¬ ((country of address 1 of aPerson) = missing value) then set phone_swe to the "+46" & phone_num else if (country of address 1 of aPerson) = "Japan" then set phone_num to "+81" & phone_num else if ((country of address 1 of aPerson) = "USA") then set phone_num to "+1" & phone_num else if (country of address 1 of aPerson) = "Another Country" then --handle phone number for "Another Country" here, etc... end if end if set skype_url to "callto://" & phone_num tell application "Skype" get URL skype_url activate end tell return true end perform action end using terms from (* Saschas fast search/replace routine for AppleScript searching and replacing in a string. This routine is my very own invention. So if you use it in your own scripts (that's OK with me!), then I want you to credit me within the source of your AppleScript and within any Readme-Files and Documentation your AppleScripts may have. (Just keep this comment in your script.) See how I did with David Cortrights great "getSelectedMessages" Routine? This routine is approx. > 300 times faster than searching replacing by looping through all the characters in a string. Author: Sascha Welter <swelter@mus.ch> *) on austauschen(suchen, ersetzen, theString) -- Parameters: search, replace, the String set olddelis to my text item delimiters set my text item delimiters to (suchen) tell me to set thelist to (every text item of theString) set my text item delimiters to (ersetzen) set theString to thelist as string set my text item delimiters to olddelis return theString end austauschen