What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Update checker

Update checker
Author: Message:
ArkaneArkade
Full Member
***

Avatar
The One and Only

Posts: 193
Reputation: 5
38 / Male / Flag
Joined: Mar 2007
O.P. Update checker
Hey guys, I'm really struggling with something here, I've tried to add an update checker to my script.

code:
function CheckforUpdates()
{
    var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp.open("GET","http://arkanes-arkade.co.uk/XBox/ScriptVersion.txt", true);
    xmlhttp.send(Math.round(Math.random()*99999));
    xmlhttp.onreadystatechange=function()
    {
        if(xmlhttp.readyState==4)
        {
            var resp = xmlhttp.responseText;
            Debug.Trace(resp);
            if(resp != "Version: " + ScriptVersion)
            {
                resp=resp.split(" ");
                if(resp[1]>ScriptVersion)
                {
                    MsgPlus.DisplayToast("XBMC", "Script Update Available!\nClick here to download now", "", "ScriptUpdate", ScriptVersion);
                }
            }
        }
    xmlhttp.close;
    }
}

I don't understand the problem.  Every time I get the toast popup.  I added the debug to find out what my reply was, and I get these errors.

[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML><HEAD><TITLE>The page cannot be displayed</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
<STYLE type="text/css">
  BODY { font: 8pt/12pt verdana }
  H1 { font: 13pt/15pt verdana }
  H2 { font: 8pt/12pt verdana }
  A:link { color: red }
  A:visited { color: maroon }
</STYLE>
</HEAD><BODY><TABLE width=500 border=0 cellspacing=10><TR><TD>

<h1>The page cannot be displayed</h1>
The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.
<hr>
<p>Please try the following:</p>
<ul>
<li>Contact the Web site administrator if you believe that this request should be allowed.</li>
<li>Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly. </li>
</ul>
<h2>HTTP Error 405 - The HTTP verb used to access this page is not allowed.<br>Internet Information Services (IIS)</h2>
<hr>
<p>Technical Information (for support personnel)</p>
<ul>
<li>Go to <a href="http://go.microsoft.com/fwlink/?linkid=8180">Microsoft Product Support Services</a> and perform a title search for the words <b>HTTP</b> and <b>405</b>.</li>
<li>Open <b>IIS Help</b>, which is accessible in IIS Manager (inetmgr),
and search for topics titled <b>Setting Application Mappings</b>, <b>Securing Your Site with Web Site Permissions</b>, and <b>About Custom Error Messages</b>.</li>
</ul>

</TD></TR></TABLE></BODY></HTML>[code]

I've contacted my host, but they tell me there is no reason for this error except due to my script being wrong. I don't think this is the case to be completely honest, as it worked with a free site, but if they aren't letting me get anywhere I have to try this.  I need some way to adapt this to work with my site.  any ideas?

Cheers all
[Image: adsig.jpg]
01-28-2008 04:37 PM
Profile E-Mail PM Web Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: Update checker
I think there's a problem with:
code:
xmlhttp.send(Math.round(Math.random()*99999));
because a "normal" GET query looks like "key=value&this=that", although I know that "page.php?81256" should work too...

Although, there's a much better way to make sure that the downloaded file is always the latest version from the server. The Win32 API function "DeleteUrlCacheEntryW" will make sure that the cached version of the requested page is removed before you execute the XmlHttp request.
code:
var sUrl = "http://arkanes-arkade.co.uk/XBox/ScriptVersion.txt";
Interop.Call('wininet.dll', 'DeleteUrlCacheEntryW', sUrl); //Clear URL from cache
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET", sUrl, true);
xmlhttp.send();
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
01-28-2008 05:51 PM
Profile E-Mail PM Web Find Quote Report
ArkaneArkade
Full Member
***

Avatar
The One and Only

Posts: 193
Reputation: 5
38 / Male / Flag
Joined: Mar 2007
O.P. RE: Update checker
Thank you sooooo much Mattike.  Thats absolutely perfect :D
[Image: adsig.jpg]
01-28-2008 09:05 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


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