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

[Release] MsgHelp Private Message Notifier
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [Release] MsgHelp Private Message Notifier
quote:
Originally posted by mickael9
quote:
Though it depends on what "Check Now" stands for. Checking for updates ("controleren op updates")? Checking something cool out ("zie dit" or something like that... sounds dodgy though)? Checking a setting ("nu selecteren")? etc...

"Check for new private messages." :P
Then I would say "Nu controleren".

-------------

btw, can I suggest another way of logging in?

The current method logs people out, even if they don't wanna. Also, all the steps you do aren't needed.

Just go directly to "http://shoutbox.menthix.net/private.php?fid=1" and if a page appears that the user isn't logged in, only then explicitly log in (and back out later). If that page isn't shown, the user is already logged in and you will go directly to the inbox. In the latter case, you should not log out either.

-------------

Another suggestion: The title of the script is "MsgHelp Private Message Notifier". This is too long to be shown in the script list. Also you use "MsgHelp PM Notifier" as title for the prefs window, which is inconsistant with the script's title. So, to strike two flies at the same time, I would stick to "MsgHelp PM Notifier" for the script title and message boxes, etc too.

-------------

Other stuff to optimize:

code:
String.prototype.isEmpty = function()
{
    if (this.replace(/^ +/, '').replace(/ +$/, '') == '')
        return true;
   
    return false;
}
To trim a string from spaces, you can use this.replace(/^ +| +$/g, '')
Also, you don't need an IF THEN if you directly return true or false according to the check.
thus:
code:
String.prototype.isEmpty = function()
{
    return (this.replace(/^ +| +$/g, '') === '')
}
(and instead of a space, maybe better use a spacing character which is  \s

-------------

In the Settings.Set prototype I would suggest to add a third parameter which defines the type of registry key you're going to write. As it is now, you only write strings, but CheckInterval and Enable are better to be written as DWORDs.

-------------

Instead of using == and != here and there, use === and !==.
See JScript 5.6 documentation or one of my forum posts why.

-------------

I see you check on no/empty input and then set the focus to that control... All I can say is (y)(y)(y) for this. Most complete and user friendly checking I've seen.

You also don't write settings to the registry when it is not needed (eg: when starting up or when user hasn't changed anything), also (y) (some scripts do write (default) stuff to the registry, eg: when they can't find a setting, which is (n)).

Example for all :D

-------------

Related to the above, check if the CheckInterval isn't greater than
86400000/60/1000 = 1440, since a timer value can't be bigger than 86400000.

Don't forget to change function SettingsOK too.

-------------

code:
function Logout_Callback()
{
    if (objXmlHttp.readyState == 4)
    {
        Login();
    }
}
Isn't that going to give an endless loop when there is some fault where the user of the script isn't the user who was logged in??? trying to log in, different user detected, log out, trying to log in, different user detected, log out, trying to log in, etc...

I can understand you first log out and then try to log in with the correct user, but the way it is implemented will also make that you constantly loop when the logging in fails and when again another user is shown.

Either do it differently, or make it only check a certain amount of times and then showing an error.

-------------

code:
function OnEvent_Initialize(blnMessengerStart)
{
    LoadStrings();
   
    if (SettingsOK())
        StartTimerAndCheck();

    else
        ShowConfigDialog();
}
Do not use OnEvent_Initialize to load the settings. Use OnEvent_SignIn or even better OnEvent_SigninReady which makes your script user specific (also store your settings user specific!!!), which is very very very mandatory for something like this!!! (And don't forget to cancel the timer when the user signs out of course).

-------------

code:
function OnEvent_Timer(strTimerId)
{
    if (strTimerId == 'CheckTimer')
    {
        StartTimerAndCheck();
    }
}
Since you only use one timer, you don't need to check upon the timer id. And thus:
code:
function OnEvent_Timer()
{
    StartTimerAndCheck();
}
Same goes for the event OnEvent_MenuClicked.

-------------

code:
function OnGetScriptMenu(intLocation)
{
    var strMenu = '<ScriptMenu>';
    strMenu    +=     '<MenuEntry Id="mnuSettings">' + Lang.Settings + '</MenuEntry>';
    strMenu    += '</ScriptMenu>';
   
    return strMenu;
}
No need for the variable and parameters:
code:
function OnGetScriptMenu()
{
    return '<ScriptMenu>'
      +      '<MenuEntry Id="mnuSettings">' + Lang.Settings + '</MenuEntry>'
      +    '</ScriptMenu>';
}

-------------

if (objFileName.match(/^(.*)\.xml$/i))
=>
if (objFileName.match(/^(.+)\.xml$/i))

This post was edited on 12-22-2006 at 11:37 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
12-22-2006 10:36 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Release] MsgHelp Private Message Notifier - by mickael9 on 12-06-2006 at 11:01 PM
RE: [Release] MsgHelp Private Message Notifier - by matty on 12-06-2006 at 11:07 PM
RE: [Release] MsgHelp Private Message Notifier - by Nagamasa on 12-06-2006 at 11:13 PM
RE: RE: [Release] MsgHelp Private Message Notifier - by mickael9 on 12-06-2006 at 11:25 PM
RE: [Release] MsgHelp Private Message Notifier - by Nagamasa on 12-06-2006 at 11:36 PM
RE: [Release] MsgHelp Private Message Notifier - by Spunky on 12-07-2006 at 12:19 AM
RE: [Release] MsgHelp Private Message Notifier - by mickael9 on 12-07-2006 at 11:23 AM
RE: [Release] MsgHelp Private Message Notifier - by Matti on 12-07-2006 at 04:12 PM
RE: RE: [Release] MsgHelp Private Message Notifier - by mickael9 on 12-07-2006 at 04:25 PM
RE: RE: RE: [Release] MsgHelp Private Message Notifier - by Matti on 12-07-2006 at 04:42 PM
RE: RE: RE: RE: [Release] MsgHelp Private Message Notifier - by J-Thread on 12-07-2006 at 05:02 PM
RE: RE: RE: RE: [Release] MsgHelp Private Message Notifier - by mickael9 on 12-07-2006 at 05:03 PM
RE: [Release] MsgHelp Private Message Notifier - by foaly on 12-07-2006 at 05:06 PM
RE: RE: [Release] MsgHelp Private Message Notifier - by mickael9 on 12-07-2006 at 06:05 PM
RE: [Release] MsgHelp Private Message Notifier - by CookieRevised on 12-07-2006 at 06:27 PM
RE: RE: [Release] MsgHelp Private Message Notifier - by mickael9 on 12-07-2006 at 06:40 PM
RE: RE: RE: [Release] MsgHelp Private Message Notifier - by CookieRevised on 12-07-2006 at 06:59 PM
RE: RE: RE: [Release] MsgHelp Private Message Notifier - by Matti on 12-07-2006 at 07:33 PM
RE: [Release] MsgHelp Private Message Notifier - by mickael9 on 12-07-2006 at 07:10 PM
RE: [Release] MsgHelp Private Message Notifier - by CookieRevised on 12-08-2006 at 02:35 PM
RE: [Release] MsgHelp Private Message Notifier - by mickael9 on 12-21-2006 at 07:21 PM
RE: [Release] MsgHelp Private Message Notifier - by Jimbo on 12-21-2006 at 07:25 PM
RE: [Release] MsgHelp Private Message Notifier - by CookieRevised on 12-21-2006 at 11:06 PM
RE: RE: [Release] MsgHelp Private Message Notifier - by mickael9 on 12-22-2006 at 05:14 PM
RE: [Release] MsgHelp Private Message Notifier - by CookieRevised on 12-22-2006 at 10:36 PM
RE: RE: [Release] MsgHelp Private Message Notifier - by mickael9 on 12-23-2006 at 09:40 AM
RE: [Release] MsgHelp Private Message Notifier - by mickael9 on 12-23-2006 at 01:04 PM
RE: RE: RE: [Release] MsgHelp Private Message Notifier - by CookieRevised on 12-23-2006 at 06:23 PM
RE: [Release] MsgHelp Private Message Notifier - by dekline on 12-31-2006 at 01:21 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