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

[Release] Gradient Text
Author: Message:
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: [Realse] Gradient Text
Not the best script i've ever seen, why use a config file when you can use the registry, the registry is a lot easier and needs less code...

Also why the Gradient Script.js file without any code in it? Just the Initialize and Uninitialize events are in there and they do nothing...

Tried to edit your code a little to make it better, please don't take this in the wrong way, i'm simply trying to help :D

Allright, you read your config file EVERY time a message was sent, I just load the gradient information IF it is present on signing, if somehow it can't be loaded, error or first time use, it will default to 1 and 4.

It will only save the gradient information on signout, so I just cut back the reading and writing to once on signing and once on signout.
Also because the registry is much easier to use than a config file it's multi-user to it saves color information per-user.

Those are the major changes, minor changes are that I used a regex to see if the /xconfig command was called, just because... well.. I like regex :P (Just started learning regex so also using it in practice to learn) and making a seperate function for the creation of the config window.

Also... I havn't tested it, because my computer is acting up and well... No time have to get up early tommorrow...

code:
//Initialize the color variables to make them globaly accessable
var color1;
var color2;

function OnconfigEvent_CtrlClicked(Wnd, ControlId)
{
  try
  {
    //try catching the colors from the controls
    color1 = Wnd.GetControlText('clr1');
    color2 = Wnd.GetControlText('clr2');
  }
  catch(err)
  {
    //If it fails for some odd reason Display A Toast to tell the user about it
    MsgPlus.DisplayToast("GRADIENTER", "Changing Color Failed");
  }
  //Close the Config Window
  Wnd.Close(1);
}

function OnEvent_ChatWndSendMessage(ChatWnd, sMessage)
{
  if (sMessage.Match(/^\/xconfig$/i) != null)
  {
    CreateConfigWnd();
    return "";
  }
  else
  {
    return "[c=" + color1 + "]" + sMessage + "[/c=" + color2 + "]";
  }
}

function OnEvent_Signin(Email)
{
  try
  {
    //Try reading the colors from the registry
    color1 = ReadRegistry("color1");
    color2 = ReadRegistry("color2");
  }
  catch(err)
  {
    //If anything fails it will default to these colors
    color1 = "1";
    color2 = "4";
  }
}

function OnEvent_Signout(Email)
{
  try
  {
    //Try Writing the colors to the registry
    WriteRegistry("color1", color1);
    WriteRegistry("color2", color2);
  }
  catch(err)
  {
    MsgPlus.DisplayToast("GRADIENTER", "Error saving gradient information");
  }
}

function CreateConfigWnd()
{
  var configWnd = MsgPlus.CreateWnd("Interface.xml", "Config");
  configWnd.SetControlText('clr1', color1);
  configWnd.SetControlText('clr2', color2);
}

function WriteRegistry(key, value)
{
  var Shell = new ActiveXObject("WScript.Shell");
  return Shell.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyEmail + "\\" + key, value);
}

function ReadRegistry(key)
{
  var Shell = new ActiveXObject("WScript.Shell");
  return Shell.RegRead(MsgPlus.ScriptRegPath + Messenger.MyEmail + "\\" + key);
}
[Image: 1-0.png]
             
07-05-2006 10:55 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Release] Gradient Text - by craig2k5 on 07-05-2006 at 10:02 PM
RE: [Realse] Gradient Text - by Joereynolds89 on 07-05-2006 at 10:10 PM
RE: [Realse] Gradient Text - by craig2k5 on 07-05-2006 at 10:19 PM
RE: [Release] Gradient Text - by Joereynolds89 on 07-05-2006 at 10:31 PM
RE: [Release] Gradient Text - by craig2k5 on 07-05-2006 at 10:39 PM
RE: [Release] Gradient Text - by Joereynolds89 on 07-05-2006 at 10:55 PM
RE: [Realse] Gradient Text - by Ezra on 07-05-2006 at 10:55 PM
RE: [Release] Gradient Text - by Chris4 on 07-05-2006 at 10:59 PM
RE: [Release] Gradient Text - by Joereynolds89 on 07-05-2006 at 11:02 PM
RE: [Release] Gradient Text - by craig2k5 on 07-05-2006 at 11:04 PM
RE: [Release] Gradient Text - by Chris4 on 07-05-2006 at 11:12 PM
RE: [Release] Gradient Text - by Ezra on 07-05-2006 at 11:13 PM
RE: [Release] Gradient Text - by Joereynolds89 on 07-05-2006 at 11:25 PM
RE: [Release] Gradient Text - by craig2k5 on 07-05-2006 at 11:30 PM
RE: [Release] Gradient Text - by Ezra on 07-05-2006 at 11:31 PM
RE: [Release] Gradient Text - by craig2k5 on 07-05-2006 at 11:36 PM
RE: [Release] Gradient Text - by MX-G on 07-05-2006 at 11:41 PM
RE: [Release] Gradient Text - by Joereynolds89 on 07-05-2006 at 11:49 PM
RE: [Release] Gradient Text - by craig2k5 on 07-05-2006 at 11:54 PM
RE: [Release] Gradient Text - by Joereynolds89 on 07-06-2006 at 12:00 AM
RE: [Release] Gradient Text - by craig2k5 on 07-06-2006 at 12:13 AM


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