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

Pages: (3): « First « 1 2 [ 3 ] Last »
[Release] Exit WLM
Author: Message:
markee
Veteran Member
*****

Avatar

Posts: 1621
Reputation: 50
35 / Male / Flag
Joined: Jan 2006
RE: RE: RE: RE: [Release] Exit Messenger - script attached
quote:
Originally posted by CookieRevised
almost, since that regular expression does not work properly.

What you need to take in account:

- a command always starts with only 1 slash "/" (not two, or more)
^^ your reg exp fails here since you don't exclude second or more slashes.

- after the slash there can not be a spacing character
^^ your reg exp fails here since you define the exclussion list to be 0 or more times ("*") when it should be 1 or more times ("+").
PS: a space (ascii 32) is also a spacing character ("\s") so you don't need to define that seperatly in the exclussion list.


- commands should be case insensitive, but parameters are not!
^^ your reg exp fails here since you don't lowercase the command. Yet you use the case insensitive marker. But this does not do anything, since there are no characters in the regular expression. That marker is for searching on all cases, not to convert cases.

- after the command there can be many spacing characters. In many cases (if not all), the user/coder simply wants the parameter to begin without any spacing characters. But Plus!'s default behaviour is to take every occuring spacing character after the first spacing character after the command as part of the parameter (though not that usefull for almost all scripts).
^^ your reg exp fails here since you don't specify a spacing character ("\s") but only a space (ascii 32).

- a parameter can contain multiple lines.
^^ your reg exp fails here too since you check on 'any' character ("."),  but 'any' character does not include new line characters ("\n").
Thanks for that, I always miss the minor details but at least you are there to fix me up <3

quote:
A proper generic regular expression to seperate the command and parameter:

code:
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) {
    if (/^\/([^\s\/]+)\s*([\s\S]*)$/.exec(sMessage) !== null) {
        var command = RegExp.$1.toLowerCase();
        var parameter = RegExp.$2;
        switch (command) {
            case 'quit':
                // <- Do something when the user typed the command quit
                return '';
            case 'exit':
                // <- Do something when the user typed the command exit
                return '';
            case 'cancel':
                // <- Do something when the user typed the command cancel
                return '';
        }
    }
}

Thanks, I'm noting this one down.


quote:
If you only have 1 command in your script (eg: /explode) your can use something like:
code:
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) {
    if (/^\/explode\s*([\s\S]*)$/i.exec(sMessage) !== null) {
        var parameter = RegExp.$1;
        // <- Do something when the user typed the command explode
        return '';
    }
}
In above two snippets:
- to let the parameter include all leading spacing characters like Plus! nativly does, change  \s*  to  \s?

;)

I'm sorry to tell you but your expression also fails I'm sorry to say (but not as much as mine :P). It should be this:
code:
function OnEvent_ChatWndSendMessage(oChatWnd, sMessage) {
    if (/^\/explode\s*([\s\S]*)$/.exec(sMessage) !== null) {//not case insensitive
        var parameter = RegExp.$1;
        // <- Do something when the user typed the command explode
        return '';
    }
}
Otherwise "/EXPLODE" would also work and any other instance of "/explode" that uses whichever case wherever through the word.  I'll let you off this once though ;)
[Image: markee.png]
12-19-2006 02:02 AM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [Release] Exit WLM
quote:
Originally posted by markee
Otherwise "/EXPLODE" would also work and any other instance of "/explode" that uses whichever case wherever through the word.
That is exactly how commands should work.

Commands _are_ case insensitive...
Hence the "i" marker _must_ be there.
The command /EXPLODE is exactly the same as /exPloDe and /explode.
This is how Plus! behaves and this should be how any script behaves. You should not force the user to use only a special cased command.

;)

This post was edited on 12-19-2006 at 02:21 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
12-19-2006 02:06 AM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
O.P. RE: [Release] Exit WLM
quote:
Originally posted by markee
Thanks, I'm noting this one down.

Same here :p I guess I should start doing things more professionally now :D

Thanks Cookie and Markee

This post was edited on 12-19-2006 at 02:08 AM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
12-19-2006 02:08 AM
Profile PM Find Quote Report
warmth
Veteran Member
*****

Avatar
Electronic Engineer

Posts: 1730
Reputation: 26
39 / Male / Flag
Joined: Jul 2003
RE: [Release] Exit WLM
How about one command to kill all the messenger accounts (if you have one, two, three, for, etc...) opened... and all related programs like MPL! and msgdiscovery! cause when you open many messengers... many of these programs open and is very anoying to close each one... for example I have 3 accounts and I have to close the 3 wlm and 3 msgdiscovery... (sorry but I don't know how to close the MPL! jajajaja, I did in the past CTRL+ALT+DEL and search for it... but now that doesn't to work i think...)
@warmth - Beta Testing a life!
Official Nokia (former Ovi) Suite Beta Tester | Nokia Beta Labs Contributor of the month (June, 2011)
12-22-2006 11:38 PM
Profile PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
O.P. RE: [Release] Exit WLM
quote:
Originally posted by warmth
sorry but I don't know how to close the MPL! jajajaja, I did in the past CTRL+ALT+DEL and search for it... but now that doesn't to work i think...

It is no longer a seperate process from what I understand. It "merges" with the WLM process meaning that it can't be closed without WLM closing too (to the best of my knowledge at least)
<Eljay> "Problems encountered: shit blew up" :zippy:
12-23-2006 01:27 AM
Profile PM Find Quote Report
warmth
Veteran Member
*****

Avatar
Electronic Engineer

Posts: 1730
Reputation: 26
39 / Male / Flag
Joined: Jul 2003
RE: [Release] Exit WLM
yes I supposed that... jajaja don't worry... but you can do what I told u? a command to close all the multiples sesions?
@warmth - Beta Testing a life!
Official Nokia (former Ovi) Suite Beta Tester | Nokia Beta Labs Contributor of the month (June, 2011)
12-23-2006 08:33 AM
Profile PM Web Find Quote Report
Pages: (3): « First « 1 2 [ 3 ] 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