What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Help] Searching pages

[Help] Searching pages
Author: Message:
AberNStein
Full Member
***


Posts: 132
Reputation: 2
Joined: Jul 2006
RE: [Help] Searching pages
i've got a script doing pretty much that. i had a thread about it a while ago.

the checkdupe(datum) function checks whether the given input is in the logfile (returns true or false), and the logging(datum) saves the given input to the logfile
getdata() reads the given website, and then calls parseTt(htmls).
in my script, parseIt iterates through all the links in the page, then for each one with "[release]" in the link's innerHTML that isn't already in the logfile, it pops up a toast. then it adds it to the logfile. pretty straightforward really.

oh and the script might give you a runtime error. ignore it.

right now it just goes when i start up messenger but it wouldn't be hard to make it go every 10 mins or whatever. just call getData();

code:
function OnEvent_Initialize(MessengerStart) {
}

var TheFile = MsgPlus.ScriptFilesPath + "\\log.txt";
var fso = new ActiveXObject("Scripting.FileSystemObject");
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

getData();

function checkDupe(datum) {
if(fso.FileExists(TheFile)) {
var a = fso.OpenTextFile(TheFile, 1);
var text = a.ReadAll();
text = text.split('\r\n');
for(var i = 0;i<text.length;i++)
if(text[i] == datum) {
a.Close();
return true;
}
a.Close();
return false;
}
}
function logging(datum) {
if(fso.FileExists(TheFile)) {
if(checkDupe(datum))
return;
a = fso.OpenTextFile(TheFile, 8);
} else
var a = fso.OpenTextFile(TheFile,2,true);
a.WriteLine(datum);
a.Close();
}

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);
}

function parseIt(htmls)
{
var foo = "";
var oDoc = new ActiveXObject("htmlfile");
oDoc.open();
oDoc.write(htmls);
oDoc.close();
var links = oDoc.getElementsByTagName("a");
for (var i=0; i<links.length; i++) {
foo = links[i].innerHTML.toLowerCase()
if (foo.indexOf("[release]") > -1 && !checkDupe(links[i].innerHTML)) {
MsgPlus.DisplayToast("MsgHelp.net [Release]",links[i].innerHTML,'','OpenSite',links[i].HREF);
logging(links[i].innerHTML);
}
}
}

function OpenSite(url) {
new ActiveXObject('WScript.Shell').run('http://shoutbox.menthix.net/' + url);
}

function OnEvent_Uninitialize(MessengerExit) {
}

edit: for some reason OpenSite(url) isn't working properly. i'd much appreciate it if someone could go over my code and improve it. if not, i'll fix it when i get back (i'm going away for two weeks).

This post was edited on 08-11-2006 at 04:58 PM by AberNStein.
[Image: gybouserbar6hc.gif]
08-11-2006 04:34 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Help] Searching pages - by Paril on 08-11-2006 at 12:57 PM
RE: [Help] Searching pages - by RaceProUK on 08-11-2006 at 03:35 PM
RE: [Help] Searching pages - by Paril on 08-11-2006 at 03:37 PM
RE: [Help] Searching pages - by AberNStein on 08-11-2006 at 04:34 PM
RE: [Help] Searching pages - by Paril on 08-11-2006 at 05:22 PM
RE: [Help] Searching pages - by Paril on 08-11-2006 at 08:19 PM
RE: [Help] Searching pages - by AberNStein on 08-11-2006 at 09:21 PM
RE: [Help] Searching pages - by J-Thread on 08-11-2006 at 09:23 PM
RE: [Help] Searching pages - by AberNStein on 08-11-2006 at 09:27 PM
RE: [Help] Searching pages - by J-Thread on 08-11-2006 at 09:38 PM
RE: [Help] Searching pages - by Paril on 08-12-2006 at 10:38 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On