Broken Skype Applescripts Fix…

Some of you may know that  Skype have an API that you can access via Applescript. To do such tasks as send sms text messages.

You may have found that for some unexplained reason this has stopped working?

 

The Background

I have used a Applescript inside an Automator app to automatically send out sms text messages using skype and run using the Calander.app.

Part of the script


 

on _skype ( thePhone, the_body , myNotice, myPhone )

 tell application “Skype”

launch

delay 10

set theSMSText to the_body— you message

set TheSMS to ( word 2 of ( send command (“CREATE SMS OUTGOING ” & thePhone & “,” & myPhone) script name “Notifier”) as text)

send command ((“SET SMS ” & TheSMS & ” BODY ” & theSMSText) as string) script name “Notifier”

send command ((“ALTER SMS ” & TheSMS & ” SEND”) as string) script name “Notifier”

 

end tell

 

end _skype


The Problem

A couple of weeks ago all stopped working. The Calendar alert would fire the app would launch and fail. sms not sent. Annoying since I use these alerts to let people know it is their turn to do a task..

What I found was the code above did no longer compile. It would get stuck on the first bit of the sky command “send command”

Scouring the web I could not find what was going on but figured it must be to do with a Skype update I did recently.

THE Solution

Because I realise that the problem may be to do with the update to Skype. I check the current Skype Script Terminology  in the Applescript Script Library to see if there had been any changes to the syntax. There where none that I could see.

But the act of opening the Skype Terminology seemed to have re-registered the library with the system. As I found out when the code suddenly started compiling.

Not quite the end of the story

All was working again until today. I knew I had not done any updates to skype so WTF.

It turns out that when I launched Skype it happily told me the Skype team had updated it. Again WTF.

Opening the script library again solved the problem. But this Time I went and found the Auto update check box; That I did not know existed and unchecked it…grrr.

So if you find that your Skype code is broken then this may be why..

 

 

2 Replies to “Broken Skype Applescripts Fix…”

  1. Hi Ben,
    It is not too hard. I did a quick google for the API. But Skype have change the way they let apps interact with skype now. read: skype-desktop-api and : skype-uris

    The old API still seem to work with Applescript and the Script Library has the very basic: send v : Send command string to Skype API
    send
    command text : command string
    script name text : name of the script sending the command
    → text

    But you can find bits with a google search. I have never made calls with it but this page had some of the old API info on it. You should be able to find more.

    Here is a simple example. Good luck
    property skype_Id : ""
    set theNmber to "01010101010"
    set CallNumber to "CALL" & space & theNmber
    tell application "Skype"

    --send command "SEARCH FRIENDS" script name "Notifier"

    set theCall to send command CallNumber script name "caller"

    set skype_Id to word 2 of theCall

    my hangUp()
    end tell

    on hangUp()
    display dialog "Hang Up" buttons {"Hang Up"} default button 1

    if the button returned of the result is "Hang Up" then
    tell application "Skype" to send command "SET CALL" & space & skype_Id & space & "STATUS FINISHED" script name "caller"
    set skype_Id to ""
    end if

    end hangUp

  2. Hi, great blog. I wonder if you could point me in the right direction for getting help with what I imagine should be a fairly simple Applescript for Skype. Call, hang up, repeat. That sort of thing, with a few specified parameters. Many thanks.

Hi, Please Leave a Reply