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:
Using it is just as simple… Add it to your path and your good to go. Heres a example:
Ready when you are!
CALL 29837 STATUS UNPLACED
CALL 29837 STATUS ROUTING
CALL 29837 STATUS RINGING
CALL 29837 STATUS INPROGRESS
CALL 29837 DURATION 0
CALL 29837 DURATION 2
CALL 29837 DURATION 3
CALL 29837 DURATION 4
CALL 29837 DURATION 5
CALL 29837 DURATION 6
CALL 29837 DURATION 7
CALL 29837 STATUS FINISHED
USER someDude ONLINESTATUS ONLINE
USER someDude MOOD_TEXT Day 1.
USER someDude NROF_AUTHED_BUDDIES 0
GROUP 266 NROFUSERS 6
USER someDude MOOD_TEXT Day 4.
USER someDude NROF_AUTHED_BUDDIES 16
message echo123 hi buddy
CHAT #user/$echo123;ca36b181d1a39b50 ACTIVITY_TIMESTAMP 1296820342
MESSAGE 29961 STATUS SENDING
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.