Controlling Skype via Terminal on a Mac

UPDATE: Windows users should check out my other project, skype4cmd.

Recently Manoj Vekaria asked me if I know how he could send SMS’s via Skype from within one of his PHP scripts. After digging around we found that while there is PHP support for windows, however it doesnt work on OS X since there is no COM interface.

There is a framework that Skype provides for cocoa, that doesn’t seem to compile ‘out of the box’ on Intel machines. Fortunately there is light at the end of the tunnel for Mac developers. In recent years, Skype has maintained its support for AppleScript. Using Apple’s Scripting Bridge Framework, your Cocoa applications can ‘use’ AppleScript to talk to Skype.

But what about other programming languages like PHP, Perl and old school shell scripts (eg Bash)? I have built a command line utility using the Scripting Bridge framework that acts as a middle man. You can checkout the code via from the following URL or get your paws on a binary by clicking the link below:

Source: http://svn.trynull.com/skype4cocoa/trunk/

Binary: Download

Using it is just as simple… Add it to your path and your good to go. Heres a example:

You can see a full list of commands by downloading the Skype API Protocol Documentation from the link above or visiting my mirrored version.

To cover myself.. I should say that this is NOT a official release from the makers of Skype. I don’t guarantee that a week after publishing this application, Skype will not change how it works. All I have tested is the ability to send messages, make phone calls and send SMS. To help you out if your wondering why stuff isn’t working, here is a list of known ‘bugs’:

  • Skype doesn’t seem to return errors via scripting bridge.
  • The content that comes back from Skype can come in no particular order or not come back at all if OS-X (yes not Skype) is busy. I don’t suspect many people will have this issue.
  • If Skype isn’t running, it may be launched. A future release of the application might inform you if Skype is running or was launched.
  • When you run the application for the first time, Skype asks if it should allow for you to control it. Unfortunately, Skype thinks that “Apple Script” is requesting access.
  • Skype tends to block you (temporarily as far as i can tell) if you make too many requests.

2 thoughts on “Controlling Skype via Terminal on a Mac

  1. Pingback: Controlling Skype via CMD from Windows » Sushant Verma's Null Pointer - Always pointing

Leave a Reply