Shoutbox

Tutorial: Script update checking - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Tutorial: Script update checking (/showthread.php?tid=78940)

Tutorial: Script update checking by -dt- on 11-11-2007 at 09:55 AM

So, you guys wanted some tutorials so heres one from me :D

Its a tutorial on implementing update checking in your script :)

clicky to read it
http://blog.thedt.net/post/4/Messenger_Plus_Scrip..._checking_tutorial


RE: Tutorial: Script update checking by Felu on 11-11-2007 at 10:03 AM

Wow thats a long tutorial :P. Nice one :)


RE: Tutorial: Script update checking by Matti on 11-11-2007 at 10:20 AM

Very nice -dt-! I'm sure this is helpful for both new users who want to create their first serious scripts, as well as for developers who want to improve their current method (like me). :)

Great work! (y)


RE: Tutorial: Script update checking by user13774 on 11-11-2007 at 10:33 AM

Image error:

http://random.thedt.net/tutorial/scriptUpdating/tutorialDiagram.jpg

should be

http://random.thedt.net/tutorial/scriptUpdating/tuturialDiagram.jpg

I don't know anything about scripting for Plus! so I can't comment on that. I was just curious :wink:


RE: Tutorial: Script update checking by -dt- on 11-11-2007 at 10:41 AM

quote:
Originally posted by Markus
Image error:

http://random.thedt.net/tutorial/scriptUpdating/tutorialDiagram.jpg

should be

http://random.thedt.net/tutorial/scriptUpdating/tuturialDiagram.jpg

I don't know anything about scripting for Plus! so I can't comment on that. I was just curious :wink:
silly me, fixed :D
RE: Tutorial: Script update checking by Menthix on 11-11-2007 at 11:03 AM

Yeah, those are the kind of tutorials i like to see :D.

tuturialDiagram.jpg isn't very readable resized like that.


RE: Tutorial: Script update checking by Dempsey on 11-11-2007 at 05:03 PM

That's great!  would you mind if I use it on mpscripts tutorial section?


RE: Tutorial: Script update checking by Rolando on 11-11-2007 at 05:08 PM

Must've taken a lot of time, good job


RE: Tutorial: Script update checking by roflmao456 on 11-11-2007 at 09:37 PM

bookmarked ;)


RE: Tutorial: Script update checking by Quantum on 11-11-2007 at 10:00 PM

Great article. :im: going to learn to code this will be great. Can i submit this to dig?   

Thanks. john-t rating of 9.1 - 9.9 / 10 ;)


RE: Tutorial: Script update checking by -dt- on 11-11-2007 at 10:38 PM

quote:
Originally posted by MenthiX
Yeah, those are the kind of tutorials i like to see (Smilie)
thanks and a writing multi-language class tutorial would be quite a bit harder :(

but if nobody else wants to do it :P I'll write something up for it

quote:
Originally posted by Dempsey
That's great!  would you mind if I use it on mpscripts tutorial section?
sure, contact me on messenger and I'll send you the raw tutorial


quote:
Originally posted by john-t
Great article. :im: going to learn to code this will be great. Can i submit this to dig?   

Thanks. john-t rating of 9.1 - 9.9 / 10 ;)
no digging :P


RE: Tutorial: Script update checking by Stigmata on 11-11-2007 at 11:08 PM

* Stigmata 's method takes up half the space

code:
function CheckForUpdates(foo)
{
var xmlhttpup = new ActiveXObject("MSXML2.ServerXMLHTTP");
     xmlhttpup.open("GET", "http://www.msgpluslive.net/scripts/view/309-Myspace-Manager/",true);
     xmlhttpup.onreadystatechange=function() {
          if (xmlhttpup.readyState==4) {
              var pos=xmlhttpup.responseText.indexOf('<span class="largefilename">Myspace Manager ');
            var ver=xmlhttpup.responseText.substring(pos+44)
            pos=ver.indexOf('</span><br />');
            ver=ver.substring(0,pos)
             
               Debug.Trace('Ver On Server: ' + ver + ' - Ver On Disk: ' + MyVer);
               if(ver > MyVer){ Toast('New Version Available!\r\n\r\nClick here to download');}
                if((foo) & (ver <= MyVer)){Toast('No New Updates Available!');}
          }
     }
xmlhttpup.send(null);
}



if foo == true, a toast popup will be displayed saying no update is available, else no toast popup.


is this a bad way to do it or something? because to me it seems like a lot less hassle and quicker etc...
RE: Tutorial: Script update checking by markee on 11-11-2007 at 11:42 PM

Sorry stiggy but that code needs to be optimised.

code:
function CheckForUpdates(foo)
{
var xmlhttpup = new ActiveXObject("MSXML2.ServerXMLHTTP");
xmlhttpup.open("GET", "http://www.msgpluslive.net/scripts/view/309-Myspace-Manager/",true);
xmlhttpup.onreadystatechange=function() {
  if (xmlhttpup.readyState==4) {
  var ver = RegExp('<span class="largefilename">Myspace Manager(.*)</span><br />','i').exec(xmlhttpup.responseText);
    ver = ver[1];
    Debug.Trace('Ver On Server: ' + ver + ' - Ver On Disk: ' + MyVer);
    if(ver > MyVer){ Toast('New Version Available!\r\n\r\nClick here to download');}
    else if(foo){Toast('No New Updates Available!');}
  }
}
xmlhttpup.send(null);
}
I'll admit to not testing this before posting but it does look a lot nicer doesn't it?

Anyway, I like to make t ext file and check the build number against the number in there personally, but it wasn't a bad read.  I think any of us who do a lot of scripting ill probably use our own methods for this kind of thing but it will definitely be nice for the new scripters to have this functionality as well.
RE: Tutorial: Script update checking by -dt- on 11-12-2007 at 12:03 AM

quote:
Originally posted by Stigmata
is this a bad way to do it or something? because to me it seems like a lot less hassle and quicker etc...

quote:
Originally posted by markee
Anyway, I like to make t ext file and check the build number against the number in there personally

Personally I keep all my scripts with subversion, so its easier for me to check the ScriptInfo.xml (eg http://version.thedt.net/scripts/plusscripts/musi...ing/ScriptInfo.xml ) rather than to update some random text file and check that.

plus I think its easier for people just to upload a copy of the scriptInfo.xml rather than to parse a webpage or upload a random text file
RE: Tutorial: Script update checking by Lou on 11-12-2007 at 02:04 AM

Wow! That's a huge tutorial. If I ever get a good idea for a script, I'll use it :P.


RE: Tutorial: Script update checking by Volv on 11-12-2007 at 02:18 AM

dt's tutorial is good because it also allows retrieval of release notes and such all in one go. The tutorial is great, but it does this all just to ultimately check the version number in the end whereas so much more could be done (as he does in his actual scripts) using the extra data.

For simply retrieving version number something like Stigmata's code is fine although I personally use a PHP script. The Plus script requests page (www.whatever.com/version.php?name=Plus!Mail), the PHP script then retrieves the appropriate latest version number from database and returns it.
I like this method because it allows multiple scripts to be checked using the same system and a single URL (with a different 'name' parameter).

Either way, good job on releasing this tutorial dt. Glad to see people focused on helping others (Y)


RE: Tutorial: Script update checking by Patchou on 11-12-2007 at 04:22 AM

That's great. This is the kind of thing that makes me think I need a tutorials section in the scripts page off msgpluslive.net.


RE: Tutorial: Script update checking by NanaFreak on 11-12-2007 at 05:56 AM

quote:
Originally posted by Patchou
That's great. This is the kind of thing that makes me think I need a tutorials section in the scripts page off msgpluslive.net.
you do ;o i need somewhere to post my window tutorials =o