Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Integrate Skype users into Address Book' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Integrate Skype users into Address Book
Authored by: willjwade on May 21, '05 05:23:47AM
Ok the thing is all these applescripts are great and all that but what if your numbers arent internationally formatted?? Answer.. use the code below (NB: You may need to edit the prefix(es). I reckon for version 2 of this someone might like to do something clever by working that out from the address book..):

using terms from application "Address Book"
on action property
return "phone"
end action property

on action title for p with e
return "Dial 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 phone_num to the value of e


-- strip non-numeric characters
set numeric to ""
repeat with i from 1 to the number of characters in phone_num
if character i of phone_num is in {"+", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"} then set numeric to numeric & character i of phone_num
end repeat
set phone_num to numeric

-- replace local prefixes "0" or "00" with international prefix
set prefix to ""
set cutoff to 0
set taster to character 1 of phone_num
set taster to taster & character 2 of phone_num
if taster is "00" then
set prefix to "+"
set cutoff to 2
end if
if taster is in {"01", "02", "03", "04", "05", "06", "07", "08", "09"} then
set prefix to "+44 "
set cutoff to 1
end if

set new_num to prefix
repeat with i from cutoff + 1 to the number of characters in phone_num
set new_num to new_num & character i of phone_num

end repeat
set phone_num to new_num

skype_out(phone_num)
end perform action

end using terms from

on skype_out(phone_num)
tell application "Skype"
set call_string to "callto:" & phone_num
get URL call_string
end tell
end skype_out
Found in the comments at this blog - written by Benet Allen.

[ Reply to This | # ]