What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Capital letter & a dot

Pages: (5): « First « 1 [ 2 ] 3 4 5 » Last »
Capital letter & a dot
Author: Message:
Bmw1000c
Junior Member
**

Avatar
yay!

Posts: 45
44 / Male / –
Joined: May 2004
O.P. RE: Capital letter & a dot
---------------------------
Messenger Plus! Live
---------------------------
Couldn't start script "CapitalLetter".

The script may be defective or you may not have the proper privileges to run scripts.
---------------------------
OK   
---------------------------
I'm portuguese!
06-27-2006 04:27 PM
Profile E-Mail PM Find Quote Report
upsfeup
Junior Member
**


Posts: 67
Joined: Feb 2005
RE: Capital letter & a dot
apenas tenho isto e funciona:

code:
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage){
    sMessage = sMessage.substr(0,1).toUpperCase() + sMessage.substr(1) + '.'
     return sMessage;
}

06-27-2006 04:31 PM
Profile E-Mail PM Find Quote Report
Bmw1000c
Junior Member
**

Avatar
yay!

Posts: 45
44 / Male / –
Joined: May 2004
O.P. RE: Capital letter & a dot
lol obrigado, nao vejo diferença nenhuma mas deu na mesma :D

ENG: tks, i don't see any diference but it works


tks every1
I'm portuguese!
06-27-2006 04:34 PM
Profile E-Mail PM Find Quote Report
steve_xrcc
New Member
*


Posts: 2
Joined: Jun 2006
RE: Capital letter & a dot
I tried the script and I believe some changes could me made to it.

First of all, it should not add a dot after a punctuation symbol (? ! etc..) or any symbol in general (^_^. - it adds a dot) or after emoticons.

Then it should be able to capitalise after a punctuation mark. (Hello! how are you?) The h of how should be capitalised.

I hope I haven't frustrated anyone

This post was edited on 06-30-2006 at 10:24 AM by steve_xrcc.
06-30-2006 10:24 AM
Profile E-Mail PM Find Quote Report
upsfeup
Junior Member
**


Posts: 67
Joined: Feb 2005
RE: Capital letter & a dot
quote:
Originally posted by steve_xrcc
I tried the script and I believe some changes could me made to it.

First of all, it should not add a dot after a punctuation symbol (? ! etc..) or any symbol in general (^_^. - it adds a dot) or after emoticons.

Then it should be able to capitalise after a punctuation mark. (Hello! how are you?) The h of how should be capitalised.

I hope I haven't frustrated anyone

That was something that I knew it would'nt work! For that a more complexe code would be necessary. But still possible....

Someone willing to make a cycle that runs each letter and tests for pontuantions?
06-30-2006 12:19 PM
Profile E-Mail PM Find Quote Report
segosa
Community's Choice
*****


Posts: 1407
Reputation: 92
Joined: Feb 2003
RE: Capital letter & a dot
I had a go at it, but my mind isn't working very well today so the following is most likely highly inefficient.

code:
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage){
     return punctuate(sMessage);
}

function punctuate(s)
{
    var sentences = s.split(" ");
    for (var i = 0; i < sentences.length; i++)
    {
        if (i == sentences.length - 1 && isin(sentences[i].charAt(sentences[i].length - 1), "abcdefghijklmnopqrstuvwxyz0123456789"))
            sentences[i] =  sentences[i] + ".";
        if (i == 0)
            sentences[i] = sentences[i].charAt(0).toUpperCase() + sentences[i].substr(1);
        else
            if (isin(sentences[i-1].charAt(sentences[i-1].length - 1), ".?!"))
                sentences[i] = sentences[i].charAt(0).toUpperCase() + sentences[i].substr(1);
    }
    return sentences.join(" ");
}

function isin(needle, haystack)
{
    for (var i = 0; i < haystack.length; i++)
        if (haystack.charAt( i ) == needle)
            return true;
    return false;
}


If it's easier to read/copy/paste I pastebinned it:

http://pastebin.ca/75734

This post was edited on 06-30-2006 at 02:35 PM by segosa.
The previous sentence is false. The following sentence is true.
06-30-2006 02:34 PM
Profile PM Find Quote Report
Bmw1000c
Junior Member
**

Avatar
yay!

Posts: 45
44 / Male / –
Joined: May 2004
O.P. RE: Capital letter & a dot
tks for the code :D

This post was edited on 06-30-2006 at 04:08 PM by Bmw1000c.
I'm portuguese!
06-30-2006 04:06 PM
Profile E-Mail PM Find Quote Report
Sypher
Senior Member
****

Avatar

Posts: 623
Reputation: 15
37 / Male / Flag
Joined: Apr 2003
RE: Capital letter & a dot
Nice code Segosa!
Messenger Plus Beta Tester
Plus! Live Faq Maintainer
06-30-2006 04:20 PM
Profile PM Find Quote Report
Bmw1000c
Junior Member
**

Avatar
yay!

Posts: 45
44 / Male / –
Joined: May 2004
O.P. RE: Capital letter & a dot
i'll release a new version very soon, with a menu and with this code, download the actual version here (without the new code)

http://www.msgpluslive.net/scripts/browse/index.php?act=view&id=35
I'm portuguese!
06-30-2006 04:22 PM
Profile E-Mail PM Find Quote Report
Jellings
Full Member
***

Avatar

Posts: 121
34 / Male / –
Joined: Dec 2004
RE: Capital letter & a dot
[Image: 169qp6w.jpg]

would it be possible to make it capitalise the first word when a new line is started?
[Image: Jellings.png]


[Image: ++++-+Click+Here+-.png]
06-30-2006 10:03 PM
Profile E-Mail PM Find Quote Report
Pages: (5): « First « 1 [ 2 ] 3 4 5 » 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