What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Is there a script?

Pages: (2): « First « 1 [ 2 ] Last »
Is there a script?
Author: Message:
AngelDevil
Full Member
***

Avatar
MsgPlus! Script Developer

Posts: 175
34 / Male / Flag
Joined: Jun 2007
RE: Is there a script?
quote:
Originally posted by billyy
Really? it works fine for me :O

Have you tried it? And it works? Mmmm...
http://www.amicogeek.it - Technology blog!
02-27-2010 01:08 PM
Profile PM Find Quote Report
davidpolitis
Full Member
***


Posts: 371
Reputation: 16
Joined: Aug 2006
RE: Is there a script?
I started work on something if anyone wants to finish it... I cbf.

code:
var Shell = new ActiveXObject("WScript.Shell");
var RegPath = MsgPlus.ScriptRegPath + Messenger.MyEmail + "\\Enabled";

function isEnabled()
{
    try
    {
        val = Shell.RegRead(RegPath);
        if(val == "0")
        {
            return false;
        }
    }
    catch (err)
    {
          Shell.RegWrite(RegPath, "1");
    }
    return true;
}

function OnGetScriptMenu(Location)
{
    Menu = "<ScriptMenu>";
    if (isEnabled())
        Menu += "<MenuEntry Id=\"Disable\">Disable</MenuEntry>";
    else
        Menu += "<MenuEntry Id=\"Enable\">Enable</MenuEntry>";
    Menu += "</ScriptMenu>";
    return Menu;
}

function OnEvent_MenuClicked(MenuItemId, Location, OriginWnd)
{
    if (MenuItemId == "Disable")
    {
        Shell.RegWrite(RegPath, "0");
    }
    else
    {
        Shell.RegWrite(RegPath, "1");
    }
}

function ChangePSM()
{
    if(isEnabled())
    {
        var PSM;
        switch (NewStatus)
        {
            case 2:
            PSM = "Appear Offline";
            break;
            case 3:
            PSM = "Online";
            break;
            case 4:
            PSM = "Busy";
            break;
            case 5:
            PSM = "Be Right Back";
            break;
            case 6:
            PSM = "Idle";
            break;
            case 7:
            PSM = "Away";
            break;
            case 8:
            PSM = "In a Call";
            break;
            case 9:
            PSM = "Out to Lunch";
            break;
            default:
            PSM = Messenger.MyPersonalMessage;
        }
        Messenger.MyPersonalMessage = PSM;
    }
}

function OnEvent_Initialize(MessengerStart)
{
    if (!MessengerStart) // if messenger is signed in
    {
        ChangePSM();
    }
}

function OnEvent_MyStatusChange(NewStatus)
{
    ChangePSM();
}
02-27-2010 10:40 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: RE: Is there a script?
quote:
Originally posted by davidpolitis
code:
function isEnabled()
{
    try
    {
        val = Shell.RegRead(RegPath);
        if(val == "0")
        {
            return false;
        }
    }
    catch (err)
    {
          Shell.RegWrite(RegPath, "1");
    }
    return true;
}

:(

Why do people still use such a bad practice of cluttering people's registry by storing a standard value when there hasn't been any change in that value (it's the standard/default one)? What's wrong with having a default value just in memory? :(

CookieRevised's reply to [Release] Easy Math and Symbols 2.0.3 (second part of post)


code:
function isEnabled() {
    try {
        var val = Shell.RegRead(RegPath)
    } catch(err) {
        var val = 1
    }
    return (val != 0)
}

the rest looks almost perfect though (except for Messenger.MyUserID instead of Messenger.MyEmail (security reasons), and a very few tiny things which could be done a bit more shorter/directly) (y)

This post was edited on 02-27-2010 at 11:19 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
02-27-2010 11:05 PM
Profile PM Find Quote Report
davidpolitis
Full Member
***


Posts: 371
Reputation: 16
Joined: Aug 2006
RE: Is there a script?
Yeah... I did it quite quicky. Ideally it would be better to just store settings in an xml file.
02-27-2010 11:22 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Is there a script?
quote:
Originally posted by davidpolitis
Yeah... I did it quite quicky. Ideally it would be better to just store settings in an xml file.
yeah, possible... But even there the same principle would apply: don't write a setting when there is no change in the setting.

(y) for doing it quickly. Just slap an scriptinfo.xml on it and you're done :p

This post was edited on 02-27-2010 at 11:25 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
02-27-2010 11:25 PM
Profile PM Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« 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