What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » MsgPlus.ScriptRegPath| Problem :(

MsgPlus.ScriptRegPath| Problem :(
Author: Message:
m0nst3rkill3r
Junior Member
**

Avatar

Posts: 51
Joined: Sep 2009
O.P. RE: MsgPlus.ScriptRegPath| Problem :(
js code:
var username = "p3acemak3r";
var settings;
//savesettings();
var twitterusername;
var twittername;
var twittertimer;
var Shell=new ActiveXObject("WScript.Shell");



//var fileread = new ActiveXObject  ( 'Scripting.FileSystemObject' ).OpenTextFile ( "c:\\twitter.txt" , 1 ).ReadAll ( );

function OnEvent_Initialize ( )
{
    if ( Messenger.MyStatus < STATUS_INVISIBILE ) return false;
    loadsettings(); 
    if ( twittertimer == 0 ) return false;
    MsgPlus.AddTimer( 'nextUpdate', twittertimer*60*1000 );
}

function OnEvent_SigninReady ( sEmail ) {
    OnEvent_Initialize (  );
}



function OnGetScriptCommands()
{
    var ScriptCommands = "<ScriptCommands>";
    ScriptCommands    +=     "<Command>";
    ScriptCommands    +=         "<Name>tweet</Name>";
    ScriptCommands    +=         "<Description>Tweet</Description>";
    ScriptCommands    +=     "</Command>";
    ScriptCommands    += "</ScriptCommands>";

    return ScriptCommands;
}


function sleep(milliseconds) {
  var start = new Date().getTime();
  for (var i = 0; i < 1e7; i++) {
    if ((new Date().getTime() - start) > milliseconds){
      break;
    }
  }
}

function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
    if (Message.toLowerCase() == "/tweet"){
        loadsettings();
        getTwitterStatusFromXML ( "http://www.twitter.com/status/user_timeline/"+twittername+".xml" );
        return "";
        }

}
function OnEvent_MyPsmChange(NewPsm){
    if (NewPsm.toLowerCase() === "/tweet"){
        loadsettings();
        getTwitterStatusFromXML ( "http://www.twitter.com/status/user_timeline/"+twittername+".xml" );
        return true
    }
}


function getTwitterStatusFromXML ( url )
{
    var xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
    var xmldom = new ActiveXObject('Microsoft.XMLDOM');

    xmldom.async = true;
    xmlhttp.open('GET', url, true);

    xmlhttp.onreadystatechange = function()
    {
        if (xmlhttp.readyState === 4 && xmlhttp.status === 200 )
        {
            xmldom.loadXML ( xmlhttp.responseText );
            Debug.Trace (  xmldom.selectSingleNode ( '//statuses/status/text' ).text );
              Messenger.MyPersonalMessage = xmldom.selectSingleNode ( '//statuses/status/text' ).text;
              MsgPlus.DisplayToast("Personal Message: ", xmldom.selectSingleNode ( '//statuses/status/text' ).text);
        }
    }
    xmlhttp.send();
}


function loadsettings ( )
{
    var regPath = MsgPlus.ScriptRegPath + Messenger.MyUserId;
    twittername = Shell.RegRead(regPath  +  '\\twitterusername');
    twittertimer = Shell.RegRead(regPath  +  '\\twittertimer');
}
function savesettings(){
    var regPath = MsgPlus.ScriptRegPath + Messenger.MyUserId;
Shell.RegWrite(regPath  + "\\twitterusername", settings.GetControlText("username"));
Shell.RegWrite(regPath  + "\\twittertimer", settings.GetControlText("timer"));
}

function OnGetScriptMenu(){
    var myMenu = new PlusMenu;
    myMenu.addItem("Settings", "Settings");
    return myMenu.build();
}

function OnEvent_MenuClicked(sMenuId){
    if(sMenuId=="Settings"){
        loadsettings();
        OpenSettings();
       
    }
}
function OnEvent_Initialize(MessengerStart){
loadsettings();

}
function OpenSettings(){
    settings = MsgPlus.CreateWnd("winsettings.xml", "settings");
    settings.SetControlText("username", twittername);
    settings.SetControlText("timer", twittertimer);
}
function OnEvent_Uninitialize(MessengerExit){
if (twittertimer === 0){
return false;
}
MsgPlus.AddTimer("nextUpdate", twittertimer*60*1000);
}
function OnEvent_Timer(nextUpdate){
getTwitterStatusFromXML ( "http://www.twitter.com/status/user_timeline/"+twittername+".xml" );
}
function OnSettingsEvent_CtrlClicked(PlusWnd, ControlId) {
switch(ControlId) {
        default:
       
        break;
       
        case "settings_buttonSave":
            savesettings();
        break;
    }
}
09-18-2009 02:58 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
MsgPlus.ScriptRegPath| Problem :( - by m0nst3rkill3r on 09-18-2009 at 11:49 AM
RE: MsgPlus.ScriptRegPath| Problem :( - by matty on 09-18-2009 at 12:35 PM
RE: MsgPlus.ScriptRegPath| Problem :( - by m0nst3rkill3r on 09-18-2009 at 02:16 PM
RE: MsgPlus.ScriptRegPath| Problem :( - by matty on 09-18-2009 at 02:36 PM
RE: MsgPlus.ScriptRegPath| Problem :( - by m0nst3rkill3r on 09-18-2009 at 02:42 PM
RE: MsgPlus.ScriptRegPath| Problem :( - by matty on 09-18-2009 at 02:56 PM
RE: MsgPlus.ScriptRegPath| Problem :( - by m0nst3rkill3r on 09-18-2009 at 02:58 PM
RE: MsgPlus.ScriptRegPath| Problem :( - by matty on 09-18-2009 at 03:05 PM
RE: MsgPlus.ScriptRegPath| Problem :( - by m0nst3rkill3r on 09-18-2009 at 03:07 PM
RE: MsgPlus.ScriptRegPath| Problem :( - by Matti on 09-18-2009 at 03:34 PM
RE: MsgPlus.ScriptRegPath| Problem :( - by m0nst3rkill3r on 09-18-2009 at 03:43 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