---
title: SkypeCall extension for PopClip
date: 2013-06-07 10:20
slug: skypecall-extension-for-popclip
categories:
- Code
tags:
- applescript
- popclip
- regex
- ruby
- skype
---

![](https://brettterpstra.com/uploads/2013/06/skypecallscreenshot.jpg)

I recently added a [PopClip](http://pilotmoon.com/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][github], but the script at the heart of it is simple, so I'll post it here for reference:



```ruby
#!/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"'}
```

[View the code on GitHub](https://gist.github.com/5729733)



The regex comes from a [StackOverflow post](http://stackoverflow.com/a/123666). Once it finds a number, it just uses the Skype API to make the phone call. Easy, but handy.

**[Download Brett's PopClip Extensions v2.0.7](https://brettterpstra.com/downloads/BrettsPopclipExtensions2.0.7.zip)**

A few PopClip extensions for Markdown writing and other useful tools

[More info](https://brettterpstra.com/projects/bretts-popclip-extensions/)

[github]: https://github.com/ttscoff/popclipextensions

---

Brett is a writer and developer living in Minnesota, USA. You can follow him as ttscoff. This content is supported by readers like you. [More about Brett](https://brettterpstra.com/contact.md), including social links.

Copyright © 2026 Brett Terpstra. All rights reserved.
