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