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

[Help] Scripting Problem
Author: Message:
rikimasse97
New Member
*


Posts: 14
– / Male / Flag
Joined: Jul 2009
RE: [Help] Scripting Problem
You forgot a few ";" the rest should be right.!
This is the code that I modified:

code:
//////////////////
// Globals vars //
//////////////////
var GamerTag = '';
var WScript = new ActiveXObject('WScript.Shell');
var message = '';
var user = new Array();
var PC = new Array();


///////////////////////////
// Menu Clicked function //
///////////////////////////


function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd)
{
  switch(MenuItemId)
  {
    case "SendGamerScore":
        SendGamerScore(OriginWnd);
        Debug.Trace('[Sent] Gamerscore sent');
    break;
    case "SendStatus":
        SendStatus(OriginWnd);
        Debug.Trace('[Sent] Status sent');
    break;
    case "XboxOptions":
        if(Messenger.MyEmail != "");
        {
            GetGamerTag(Messenger.MyEmail);
        }
        plusWnd = MsgPlus.CreateWnd('Windows.xml', 'XboxOptions');
        plusWnd.SetControlText('EdtGamerTag', GamerTag);
        Debug.Trace('[Window] XboxOptions opened');
    break;
    case "XboxAbout":
        plusWnd = MsgPlus.CreateWnd('Windows.xml', 'XboxAbout');
    break;
  }
}

//////////////////////////////
// XboxOptions Clicked Function //
//////////////////////////////

function OnXboxOptionsEvent_CtrlClicked(PlusWnd, ControlId)
{    Debug.Trace('[Clicked] '+ControlId);
    switch (ControlId)
    {
        case "BtnSave":
            GamerTag = PlusWnd.GetControlText('EdtGamerTag');
               if(Messenger.MyEmail != "")
            {
                SetGamerTag(Messenger.MyEmail);
            }
            PlusWnd.Close(1);
            Debug.Trace('[Window] XboxOptions closed');
            break;
    }
}

////////////////////////////
// About Clicked Function //
////////////////////////////

function OnXboxAboutEvent_CtrlClicked(Wnd, sControlId){
    if(sControlId == "lnkWebsite"){
        new ActiveXObject("wscript.shell").run("http://shadowgaming.wordpress.com/");
    }
}

////////////////////////////////////////////
// Get the GamerTag from registry //
////////////////////////////////////////////

function GetGamerTag(email)
{    try
    {
        GamerTag = WScript.RegRead(MsgPlus.ScriptRegPath + email + '\\GamerTag');
        Debug.Trace('[Loaded] XboxLive GamerTag: '+GamerTag);
    }
    catch(exception)
    {        WScript.RegWrite(MsgPlus.ScriptRegPath + email + '\\GamerTag', '');
        GetGamerTag(email);
    }
}

//////////////////////////////////////////
// Set the GamerTag in registry //
//////////////////////////////////////////

function SetGamerTag(email)
{    WScript.RegWrite(MsgPlus.ScriptRegPath + email + '\\GamerTag', GamerTag);
    Debug.Trace('[Saved] Xbox Live GamerTag: '+GamerTag);
}

///////////////////////////////////
// The SendGamerScore function //
///////////////////////////////////

function SendGamerScore(OriginWnd)
{    if(Messenger.MyEmail != "")
    {
        GetGamerTag(Messenger.MyEmail);
        GetFeed('http://xboxapi.duncanmackenzie.net/gamertag.ashx?GamerTag='+ GamerTag, 'SendGamerScoreHandler', OriginWnd);
    }
}

function SendStatus(OriginWnd)
{    if(Messenger.MyEmail != "");
    {
        GetGamerTag(Messenger.MyEmail);
        GetFeed('http://xboxapi.duncanmackenzie.net/gamertag.ashx?GamerTag='+ GamerTag, 'SendStatusHandler', OriginWnd);
    }
}
//////////////////////////////////////
// The handler for SendGamerScore //
//////////////////////////////////////
function SendGamerScoreHandler(response, OriginWnd)
{
    // empty message var
    message = '';
   
    // Get playcount
    PC = response.selectNodes('XboxInfo');
     for(var i=0; i<PC.length; i++){
    message += GamerTag + " has a total of " + PC[i].childNodes(11).text + "GS";
    }

    OriginWnd.SendMessage(message);
}

//////////////////////////////////////
// The handler for SendStatus //
//////////////////////////////////////
function SendStatusHandler(response, OriginWnd)
{
    // empty message var
    message = '';
   
    // Get playcount
    user = response.selectNodes('XboxInfo/PresenceInfo');
     for(var i=0; i<PC.length; i++){
    message += "360 - " + GamerTag + ": " + PC[i].childNodes(2).text + " - " + PC[i].childNodes(3).text;

    }

    OriginWnd.SendMessage(message);
}

////////////////////////////////////////////////////
// Ajax functions by Lucsas van Dijk (lucasvd.nl) //
////////////////////////////////////////////////////
function GetFeed(url, callback_function, OriginWnd)
{
    var feed = create_http_object();

    feed.onreadystatechange = function();
    {
        if(feed.readyState==4)
        {
            if(feed.status == 200)
            {
                eval(callback_function + '(feed.responseXML, OriginWnd)');
            }
            else
            {
                Debug.Trace('[Error] ' + feed.status);
            }
        }
    }

    Debug.Trace('[URL] '+url);

    feed.open('GET', url, false);
    feed.send(null);
}

function create_http_object()
{
    var ActiveXTypes = [
        "MSXML2.XMLHTTP.5.0",
        "MSXML2.XMLHTTP.4.0",
        "MSXML2.XMLHTTP.3.0",
        "MSXML2.XMLHTTP",
        "Microsoft.XMLHTTP",
    ];

    for( var i = 0; i < ActiveXTypes.length; i++ );
    {
        try
        {            Debug.Trace('[ActiveX] ' + ActiveXTypes[i]);
            return new ActiveXObject( ActiveXTypes[i] );
        }
        catch( e )
        { }
    }

    try
    {
        return new XMLHttpRequest();
    }
    catch( e )
    { }

    return false;
}

07-16-2009 06:01 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Help] Scripting Problem - by Shadowajohn on 07-13-2009 at 08:22 PM
RE: [Help] Scripting Problem - by rikimasse97 on 07-16-2009 at 06:01 AM
RE: [Help] Scripting Problem - by rikimasse97 on 07-16-2009 at 06:10 AM
RE: [Help] Scripting Problem - by Shadowajohn on 07-16-2009 at 06:21 AM
RE: [Help] Scripting Problem - by rikimasse97 on 07-16-2009 at 06:25 AM
RE: [Help] Scripting Problem - by Spunky on 07-17-2009 at 02:08 PM


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