I recently added a PopClip extension for dialing Skype to my collection. It scans selected text for a 7 or 10-digit phone number, offering a Skype button in the PopClip popup if it finds one. When activated, it dials the first match in the selected text.
It seems to be working quite well, so I’ve added it to the main collection, download below. The source is available on GitHub, but the script at the heart of it is simple, so I’ll post it here for reference:
#!/usr/bin/rubyinput=ENV['POPCLIP_TEXT']# use a regex to locate all phone numbersphone_numbers=input.scan(/(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?/)# send the first one to Skype via AppleScript (osascript)%x{/usr/bin/osascript -e 'set _cmd to "CALL #{phone_numbers[0].join("")}"' -e 'tell application "Skype" to send command _cmd script name "PCDIALER"'}