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:

skypecall.rbraw
"
#!/usr/bin/ruby

input = ENV['POPCLIP_TEXT']

# use a regex to locate all phone numbers
phone_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"'}

The regex comes from a StackOverflow post. Once it finds a number, it just uses the Skype API to make the phone call. Easy, but handy.

Brett's PopClip Extensions v1.45.2

A few PopClip extensions for Markdown writing and other useful tools

Published 11/30/14.

Updated 02/07/23. Changelog

DonateMore info…