Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Trigger Skype video callback via AppleScript Internet
The following Applescript code makes Skype start a call, waits 60 seconds for reply, and when a reply is received, it will start video sending (there's no need for Skyp's auto-send-video option to be on). You can start this script in many ways:
  1. Use Mail rules configured to start the script if subject or content matches some rules you decide (the parameters here are fake, do not try this on my email). Go to Mail » Preferences, select Rules, create a new rule, choose the conditions you want to trigger the call, and under 'Perform the following action,' select 'Run AppleScript' and find your saved script.
  2. Insert some code in a PHP script -- something like (untested code): <?php $Res=`osascript -e "~/callme.scpt"`; ?>. In this way, a web page/link can start video sending. Instead of PHP, you may call a shell script directly via the web.
  3. Schedule a call with iCal. Create an event, and under Alarm, choose "Run script."
  4. Use as a folder action: when someone opens or modifies a folder, be called.
  5. Be called every time someone switches on your computer (but see below note about Skype running first; you'll need to put a long delay at the start of the script.)
Security/privacy seems OK, as the scripts only call a fixed location. And I think the API does not allow concurrent calls (no DOS attack). Do not use this to spy on other users, as the Skype call window will flicker once when the call is made, even if the process is hidden, so they will know something is happening. Read on for the script.

Here's the code:
tell application "Skype"
    set volume 0
    set Dumb to "Just do something.."
end tell
tell application "System Events"
    set visible of process "Skype" to false
    delay 2
end tell
tell application "Skype"
    set AppleScript's text item delimiters to " "
    set Res to send command "CALL fam.munafo" script name "MyScript"
    if the (count of windows) is not 0 then
        set visible of every window to false
    end if
    if (item 1 of (every text item of Res) is "CALL") then
        set CallId to my GetPart(Res, 2, " ")
        set CallStatus to "unknown"
        set MaxTries to 60
        repeat while (CallStatus is not "INPROGRESS" and CallStatus is not "REFUSED" and CallStatus is not "FAILED" and MaxTries > 0)
            if the (count of windows) is not 0 then
                set visible of every window to false
            end if
            delay 1
            set MaxTries to MaxTries - 1
            set Res to send command "GET CALL " & CallId & " STATUS" script name "MyScript"
            set CallStatus to my GetPart(Res, 4, " ")
        end repeat
        if CallStatus is not "INPROGRESS" then
            "FAILED! " & CallStatus & " After " & MaxTries
            send command "ALTER CALL " & CallId & " START_VIDEO_SEND" script name "MyScript"
        end if
    end if
    --display dialog "ALTER CALL " & CallId & " START_VIDEO_SEND"
end tell

on GetPart(s, p, d)
    set theList to every text item of s
    return (item p of theList)
end GetPart
Replace skype_user_to_call in the script with your Skype name. The first time you run the script, the Skype API will ask for permission. Instruct it to remember it (in Skype, there is a menu choice 'Manage API Clients' in the Account menu).

Skype should be running before this script starts, or it will ask for permission again (bug?), and hiding the process will fail. Probably some delay somewhere may fix this, but I assumed Skype was running, and didn't care much.

[robg adds: I haven't tested this one.]
  • Currently 2.83 / 5
  You rated: 5 / 5 (12 votes cast)

Trigger Skype video callback via AppleScript | 0 comments | Create New Account
Click here to return to the 'Trigger Skype video callback via AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.