Friday, 4 March 2011

Swivelscript for Shopping


The Tedium of Online Shopping

I'm sure most people will have been on a bargain hunt on Ebay, and have found the process extremely tedious:

  • search and browse around in Ebay
  • find an item of interest
  • look up the item on e.g. Amazon , to see what the customer reviews say, what the current new price, to see more pictures
  • make a note of the URL , price and auction end-date
  • Lather, rinse, repeat

Swivelscript to the Rescue

This proces is a prime example of the type of repeated manual process that occurs in Contact Centres, and is exactly what Swivelscript can fix. To show you the power and simplicity of Swivelscript, here is how this can be achieved.

All we need is 3 small scripts:

  • one for Ebay, to retrieve the current item details from the web UI
  • one for Amazon, to run search queries on our behalf
  • one for Excel, to make notes of the items we have visited

Here is the first script, that will retrieve the item details from Ebay, and send an event to Amazon :

// retrieve an active item from the browser
var item = document.getElementsByClassName("vi-is1-titleH1")[0];
var price = document.getElementsByClassName("vi-is1-tbll")[0];
var date = document.getElementsByClassName("vi-is1-dt")[0];
// send it to Amazon
desktop.postcommand("amazon","update(\""+escape(item.textContent)+"\");");

The second script, to run a search in Amazon, looks like this:

// register a named browser instance
var browser = desktop.createBrowser("amazon");
// and listen for commands
browser.listen();
// triggered from the Ebay script
function update(q){
    document.location.href="http://www.amazon.co.uk/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords="+encodeURI(unescape(q));
}

Finally, the script that will make a note in Excel of our item looks like this :

// connect to excel
var excel = desktop.connect("Book1");
// and write the details to excel for future reference
excel.paste(item.textContent);
excel.type("{RIGHT}");
if (price) excel.paste(price.textContent);
excel.type("{RIGHT}");
if (date) excel.paste(date.textContent);
excel.type("{RIGHT}");
excel.paste(document.location.href);
excel.type("{ENTER}{HOME}");

The end result can be seen in the following video:


Run it Yourself

To run this demo yourself, download and install the Swivelscript trial. After that, install the Firefox plugin which you can find in in

%SWIVELSCRIPT_HOME%\bin
, to enable non-intrusive use of Swivelscript.

Now just open Amazon and Ebay in Firefox, and open Excel so the script can take notes and that's it. To change the behaviour, just update the scripts in

%SWIVELSCRIPT_HOME%\html\swivelscripts
. Any updates will be picked up automatically.

Happy Swivelling!

No comments:

Post a Comment