Trigger Skype video callback via AppleScript
Aug 01, '08 07:30:01AM
Contributed by: francescomm
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:
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.
- 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.
- 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.
- Schedule a call with iCal. Create an event, and under Alarm, choose "Run script."
- Use as a folder action: when someone opens or modifies a folder, be called.
- 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.)
Here's the code:
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.]
Mac OS X Hints