Archive for the 'Technology' Category

Outlook to Skype SMS

Thursday, March 11th, 2010

I wanted to know when a process on a customer’s server had failed. In fact I wanted it to wake me up in the middle of the night so that I could fix it.

About the only usable outbound communication supported by the server is email, but my phone is not email capable (well it is, but not for work emails!).

So a colleague mentioned using MSN chat or Skype chat to send comments, and that set me wondering…

Skype has a COM library which can be used to interface with the Skype application. (A reinstall of Skype with the Extras Manager option ticked was needed to get the library installed.) The Skype4COM library allows you to send SMS. Outlook of course allows you to apply rules to incoming mail messages, and one of these allows you to run some code in a VBA module (the run a script option).

So to put it all together:

  1. A script on the customer’s server will monitor another script’s progress. If it detects a particular condition it will generate an email sent to my work email account.
  2. Outlook has a rule to look for specific text in the email subject (for example “ERROR”).  If it detects a suitable email, it will run a piece of VBA.
  3. The VBA will call skype and send the SMS message

Installation of outlook VBA code

  1. Add the code below to an outlook module
  2. Change the phone number to be your phone number (A future feature might be to include the phone number in the email subject and set this dynamically)
  3. Add a reference to the Skype4COM object in the module.

Running the solution

  1. Have outlook open, running and make sure that macros are enabeld.
  2. Have Skype open and logged in. (and have some credit for sending sms!) (it is possible to launch skype from the VBA script but I’m still tinkering with this to get it working reliably)
  3. Wait for email’s to arrive.

The Code

Sub SendSMSRule(Item As Outlook.MailItem)
    Dim strContact As String

    strContact = "+441234567890" 'Your phone number

    subSendSMS strContact, Item.Subject

End Sub

Private Sub subSendSMS(strRecipients As String, strMessage As String)
    Dim objSkype        As SKYPE4COMLib.Skype
    Dim objSMS          As SKYPE4COMLib.SmsMessage

    Set objSkype = New SKYPE4COMLib.Skype
    objSkype.Attach , True

    Set objSMS = objSkype.CreateSms(smsMessageTypeOutgoing, strRecipients)
    With objSMS
        .Body = strMessage
        .Send
    End With
KillObjects:
    Set objSMS = Nothing
    Set objSkype = Nothing
End Sub

Stop motion animation

Saturday, January 30th, 2010

This animation is a test using a DV camera and a little script I wrote to control it.

Basically I wanted to be able to use my DV camera to take single frames, which could then be rolled into a finished video.

A little shell script follows, which does just what I need, using dvgrab and ffplay.

#!/bin/bash
# script to take a shot with DV camera

count=1
calldir=`pwd`
wrapdir='wraps'

function help_me
{
echo -e "HELP!"
echo -e "h - shows this help!"
echo -e "s - takes a shot"
echo -e "p - shows a preview of all the shots so far"
echo -e "w - writes the shots to a wrap file in ./$wrapdir"
echo -e "q - quits\n"
}

help_me

if [ ! -d $calldir/$wrapdir ] ; then
mkdir $calldir/$wrapdir || exit
fi

while [ "$ans" != "q" ]
do

echo -e "I'm waiting for instructions:(h|s|p|w|q)"
read -sn1 ans

if [ "$ans" = "h" ] ; then

help_me

elif [ "$ans" = "s" ] ; then

echo -e "grabbing a frame"
dvgrab --every 25 --duration 1 2>/dev/null
echo -e "grabbed $count\n\a"

count=$(($count+1))

elif [ "$ans" = "p" ] ; then

echo -e "Preview"
cat $calldir/*.dv | ffplay -
echo -e "Preview ended"

elif [ "$ans" = "w" ] ; then

echo -e "Wrapping up"
echo -e "Creating in in $calldir/$wrapdir"
echo -e "Enter filename for wrap:"

read filename

cd $calldir/$wrapdir || exit

cat $calldir/*.dv | dvgrab -stdin --format dv2 $filename 2>/dev/null

clear

# reset count after wrapping file
count=1

echo -e "Tidying up last wrap: deleting $calldir/*.dv"
rm $calldir/*.dv

echo -e "Preview wrap"
ffplay $calldir/$wrapdir/$filename*
echo -e "Preview wrap ended"

cd $calldir || exit

elif [ "$ans" = "q" ] ; then

echo -e "Quitting...\n"
exit

fi

done

Playing with Audio

Wednesday, November 18th, 2009

I have spent quite some time recently playing with audio on my ubuntu desktop.

Last time I tried Audio on linux I found it to be a sorely disappointing affair. That was some 6 to 12 months ago.

On my old Windows box I had an E-mu 1820, but when I bought it I didn’t know that Creative didn’t like to help out by open sourcing their drivers. (How many people have bought M-Audio cards now, knowing that they can get Open Source drivers for it!) On my old Windows box I thought that card was going to stay, until week before last…

I had had some recent successes with getting jack and pulseaudio playing nicely. I had had a play with Ardour and loved it. So I bit the bullet and gave it a go.

I now have glorious multi channel playback and recording via my E-mu audiodock, so I have taken the opportunity to throw together a few recordings of my poetry. The first couple were straight recordings with a bit of reverberation added for ambience.

Virility

The Tree I Wish I’d Been

The most recent is a full on four and a half minutes of sequenced sound and samples :)

A Rude Awakening

If you are viewing this on the site you’ll see the above links as little embedded mp3 players, courtesy of the very smart wpaudio plugin.