thanks a bunch.
i've gotten quite far now with the script actually.
i'll post another version once i'm really stumped again though.
edit: here we go.
so the purpose of this script is to scrape the scripts forum and toast if there are any new requests. right now it scrapes the forum, and toasts any link with [request] (case insensitive) in it, and then it writes them to a text file. the goal is to have it check that text file before it toasts and then not toast if the thread is already there. i'll add the timer later.
p.s. there's a runtime error on line one or something, i'd rather supress it than figure it out. oh yeah and it toasts and logs twice for each one.
p.p.s. i write ugly code. don't laugh.
code:
function OnEvent_Initialize(MessengerStart)
{
getData();
}
function logging(datum)
{
var fso;
var ForAppending = 8;
var TheFile = MsgPlus.ScriptFilesPath + "\log.txt";
fso = new ActiveXObject("Scripting.FileSystemObject");
var a = fso.OpenTextFile(TheFile, ForAppending, true);
a.WriteLine(datum);
a.Close();
}
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
function getData()
{
xmlhttp.open("GET", "http://shoutbox.menthix.net/forumdisplay.php?fid=39", true);
xmlhttp.onreadystatechange = stateChanged;
xmlhttp.send(null);
}
function stateChanged()
{
if (xmlhttp.readyState==4)
{
if (xmlhttp.status==200)
{
parseIt(xmlhttp.responseText);
}
else
{
}
}
}
function parseIt(htmls)
{
var foo = "";
var oDoc = new ActiveXObject("htmlfile");
oDoc.open();
oDoc.write(htmls);
oDoc.close();
var links = oDoc.getElementsByTagName("a");
for (i=0; i<links.length; i++)
{
foo = links[i].innerHTML.toLowerCase()
if (foo.indexOf("[request]") > -1)
{
MsgPlus.DisplayToast("msghelp.net [request]",links[i].innerHTML,'','OpenSite');
logging(links[i].innerHTML);
}
}
}
function OpenSite(){
new ActiveXObject('WScript.Shell').run('http://shoutbox.menthix.net/forumdisplay.php?fid=39');
}
function OnEvent_Uninitialize(MessengerExit)
{
}