Hey guys,
I need advice yet again. I have written a script which checks an html interface and outputs the information scraped to a contact. Or rather, thats my intention. I've spent 10 mins trying to write this, but it doesnt make sense even to me, so please excuse the random code.
code:
function AzureusInfoFetch()
{
http = new ActiveXObject("Microsoft.XMLHTTP");
http.onreadystatechange=AzureusInfoRead();
http.open("GET", "http://" + "192.168.0.2" + ":" + "6885/index.tmpl", true, "StevieD", "leroux should edit his password out of scripts he posts on the forums");
http.send(null);
}
function AzureusInfoRead()
{
if ((http.readyState == 4) && (http.status == 200))
{
var Azureus = AzureusInfo(http.responseText);
Debug.Trace(Azureus);
}
http.close;
}
function AzureusInfo(text)
{
if (text.indexOf('<tr id="r'+n) > -1)
{
XBMCArtist = text.substring(text.indexOf('<tr id="r1"'), text.length);
XBMCArtist = XBMCArtist.substring(0, XBMCArtist.indexOf('</tr>')+5);
XBMCArtist=XBMCArtist.split("<td");
.....
}
Theres various formatting in this code, and it all works according to debug, but the basic point I need is for it to be called by a contact. I'm looking for the function AzureusInfoFetch() to be called when a contacts sends the message "!azureus", and then once all of the data is fetched and formatted through the other functions will send it back to the contact. I don't suppose anyone can suggest a way to do this, because I just dont seem to be able to get my head around it.
Cheers
[Sorry for the misleading topic name earlier. I got confused while writing and ending up changing what I needed help with. I wasnn't trying to trick people into viewing. Sorry]