Shoutbox

Capital letter & a dot - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Capital letter & a dot (/showthread.php?tid=61751)

Capital letter & a dot by Bmw1000c on 06-27-2006 at 03:48 PM

Hi :X
What about a script that makes your 1st letter a capital and after your last, a dot?
i think that this isn't very hard to do.

Someone?


RE: Capital letter & a dot by Lou on 06-27-2006 at 03:56 PM

quote:
Originally posted by Bmw1000c
What about a script that makes your 1st letter a capital and after your last, a dot?
Where would you want this? Please elaborate.
RE: Capital letter & a dot by Twozzok on 06-27-2006 at 03:57 PM

I think he means when you type a message?


RE: Capital letter & a dot by qgroessl on 06-27-2006 at 03:58 PM

That way even though he wouldn't normally use good punctuation... he would with that....


RE: Capital letter & a dot by Mike on 06-27-2006 at 04:01 PM

I made had made a StuffPlug talker for this ( StuffPlug Talker: UCase )
I might try to port this into a script.
It shouldn't be that hard...

Oh, by the way, my talker used to only capitalise the first letter.
Not the one after a dot...


RE: Capital letter & a dot by Menthix on 06-27-2006 at 04:05 PM

Even when you do such a script, that doesn't mean punctuation will be good. Unless you never type any message longer than one sentence and never use commas :).


RE: Capital letter & a dot by matty on 06-27-2006 at 04:06 PM

This should work :

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

RE: Capital letter & a dot by Bmw1000c on 06-27-2006 at 04:13 PM

Matty,
i've created a new script, and i've put that script in the box, but nothing happens

edit: @ teh debugger: Function called: OnEvent_ChatWndSendMessage


RE: Capital letter & a dot by upsfeup on 06-27-2006 at 04:15 PM

end with "return sMessage;"


RE: Capital letter & a dot by hmaster on 06-27-2006 at 04:15 PM

edit, the return works fine.


RE: Capital letter & a dot by Bmw1000c on 06-27-2006 at 04:27 PM

---------------------------
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   
---------------------------


RE: Capital letter & a dot by upsfeup on 06-27-2006 at 04:31 PM

apenas tenho isto e funciona:

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


RE: Capital letter & a dot by Bmw1000c on 06-27-2006 at 04:34 PM

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


RE: Capital letter & a dot by steve_xrcc on 06-30-2006 at 10:24 AM

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


RE: Capital letter & a dot by upsfeup on 06-30-2006 at 12:19 PM

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?

RE: Capital letter & a dot by segosa on 06-30-2006 at 02:34 PM

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
RE: Capital letter & a dot by Bmw1000c on 06-30-2006 at 04:06 PM

tks for the code :D


RE: Capital letter & a dot by Sypher on 06-30-2006 at 04:20 PM

Nice code Segosa!


RE: Capital letter & a dot by Bmw1000c on 06-30-2006 at 04:22 PM

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


RE: Capital letter & a dot by Jellings on 06-30-2006 at 10:03 PM

[Image: 169qp6w.jpg]

would it be possible to make it capitalise the first word when a new line is started?


RE: RE: Capital letter & a dot by segosa on 07-01-2006 at 06:08 AM

quote:
Originally posted by Jellings
[Image: 169qp6w.jpg]

would it be possible to make it capitalise the first word when a new line is started?


Try change

code:
if (isin(sentences[i-1].charAt(sentences[i-1].length - 1), ".?!"))


to

code:
if (isin(sentences[i-1].charAt(sentences[i-1].length - 1), ".?!\n"))


Not sure if it'll work though.
RE: Capital letter & a dot by steve_xrcc on 07-01-2006 at 06:10 AM

I thought of a part of an algorithm -
If last character := A..Z or a..z or 0..9 then add a dot at end of sentence

I think it would be shorter to write than something else, right?


RE: Capital letter & a dot by Bmw1000c on 07-01-2006 at 09:34 AM

it works like a charm ;)


RE: Capital letter & a dot by Tartooob on 07-01-2006 at 11:59 AM

Well works fine but it wont let me use my emotions properly or use commands such as /ping.

Can anyone fix please ?


RE: Capital letter & a dot by Alexcess on 07-01-2006 at 04:17 PM

Hi! I have tried it and yes, it wont let you use the / commands, but if you set an space after those, you will be able to use them.

Instead of "/ping", try "/ping "


Oh! But when you have this script enabled, you can't use the plus! downloaded sounds... sad thing:(


RE: Capital letter & a dot by Sypher on 07-01-2006 at 04:56 PM

It needs some checking:
- For sentences starting with /
- For sentences starting with www. or http://


RE: Capital letter & a dot by hmaster on 07-01-2006 at 04:59 PM

code:
if (sMessage.charAt(0) != '/' && sMessage.substr(0, 4) != 'www.' && sMessage.substr(0, 7) != 'http://') {
//code here
}

*-)
RE: RE: Capital letter & a dot by Tartooob on 07-02-2006 at 12:00 PM

quote:
Originally posted by hmaster
code:
if (sMessage.charAt(0) != '/' && sMessage.substr(0, 4) != 'www.' && sMessage.substr(0, 7) != 'http://') {
//code here
}

*-)

it stopped the script from working when I added that..
RE: Capital letter & a dot by Dark_Nightmare on 07-02-2006 at 08:20 PM

Success! After much fiddling, i've done 75% of what you guys want/need.

Typing "/" will make the rest of the message untouched by the punctuation changes.
Automatically makes the letter after a space after a "!", "?" and "." a capital.
    (ie   woot. i rocks! yep!
                 becomes
            Woot. I rocks! Yep!)

Automatically ends any open-ended sentences (ie, without any ending punctuation) with a full stop.


All that jazz...

Except, i cannot configure it so that it ignores messages starting with  "www." "http:" etc...


http://pastebin.ca/77236


By the way - i mostly used the guy a few post up's code, but tweaked it a bit.


edit:  It does affect custom emoticons, unfortunately, but only if its the first character. Just press space before entering an emoticons. :D


RE: Capital letter & a dot by dylan! on 07-02-2006 at 08:43 PM

hmm all I did was added the above 2 posts codes together and I didn't get any errors


RE: Capital letter & a dot by Mentality on 07-02-2006 at 09:03 PM

Can someone post teh full script

I'm dyslexic and can edit it all in different parts because I don't understand.

sorreh :$


RE: Capital letter & a dot by dylan! on 07-02-2006 at 09:11 PM

code:
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage){
     
     if (sMessage.charAt(0) != '/' && sMessage.substr(0, 4) != 'www.' && sMessage.substr(0, 7) != 'http://') {

}
     return punctuate(sMessage);
}

function punctuate(s)
{
    var sentences = s.split(" ");
    for (var i = 0; i < sentences.length; i++)
   
    {
        if (sentences[i].charAt(0) == "/")
         {
             return sentences.join(" ");
         }
     else{
        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;


I think someone should make it so it adds " ' " 's into the right spots:P or I could just replace all the theyre with they're and so on :dodgy:
RE: Capital letter & a dot by Mentality on 07-02-2006 at 09:22 PM

Might wanna add no parse to that post - a lightbulb smilie is putting it off abit, I wouldn't know how to correct that

I was gonna say if you accidently put "i" instead of "I" as well, something to correct that -

This is a very useful script for me I might add lol

[update]

quote:
Originally posted by dylan!
code:
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage){
     
     if (sMessage.charAt(0) != '/' && sMessage.substr(0, 4) != 'www.' && sMessage.substr(0, 7) != 'http://') {

}
     return punctuate(sMessage);
}

function punctuate(s)
{
    var sentences = s.split(" ");
    for (var i = 0; i < sentences.length; i++)
   
    {
        if (sentences[i].charAt(0) == "/")
         {
             return sentences.join(" ");
         }
     else{
        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;


I think someone should make it so it adds " ' " 's into the right spots:P or I could just replace all the theyre with they're and so on :dodgy:

Keep getting an error saying that scripts defective Dylan!

I've manged to work it out for now with the other codes - with a little help from a friend.
RE: RE: Capital letter & a dot by Tartooob on 07-03-2006 at 10:13 AM

quote:
Originally posted by Dark_Nightmare
Success! After much fiddling, i've done 75% of what you guys want/need.

Typing "/" will make the rest of the message untouched by the punctuation changes.
Automatically makes the letter after a space after a "!", "?" and "." a capital.
    (ie   woot. i rocks! yep!
                 becomes
            Woot. I rocks! Yep!)

Automatically ends any open-ended sentences (ie, without any ending punctuation) with a full stop.


All that jazz...

Except, i cannot configure it so that it ignores messages starting with  "www." "http:" etc...


http://pastebin.ca/77236


By the way - i mostly used the guy a few post up's code, but tweaked it a bit.


edit:  It does affect custom emoticons, unfortunately, but only if its the first character. Just press space before entering an emoticons. :D


Thanks bro. Works perfectly
RE: Capital letter & a dot by Sunshine on 07-03-2006 at 04:23 PM

There's one very annoying bug in this script. If you select an emote from the emoticonpanel these do not get sent (empty line..only a . ), however they will be displayed if you type the shortcut.

If this can be fixed many people would be grateful...it's annoying when you have to type/remember all these shortcuts and this will probably be a reason for many not to use this script.

More bugs:
- dots get placed after everything, even if you end the sentence yourself with a . ? or !
- If you end a sentence yourself with a . and you type on the next word does not get capitalized (no double dot there though).

Additional info: i downloaded the script from http://www.msgpluslive.net/scripts/browse/index.php?act=view&id=35


RE: RE: Capital letter & a dot by Dark_Nightmare on 07-04-2006 at 02:25 PM

quote:
Originally posted by Sunshine

Additional info: i downloaded the script from http://www.msgpluslive.net/scripts/browse/index.php?act=view&id=35



That script is different to the code i posted.
My code doesn't place a full stop after an exlamation mark, nor a question mark.

In regards to your emot problem - my script, again, doesnt have these problems.


Just so you know, this is the script you downloaded:

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


If you looked at my code, you would notice that it is far longer.


Please do not blame my code for another code's bugs!


Note: I use the term "my code" loosely. Code not 100% created by me - but i have tested, debuged, tested, debuged and then i tested and debugged some more.
RE: Capital letter & a dot by Sunshine on 07-04-2006 at 02:37 PM

quote:
Originally posted by Dark_Nightmare
Please do not blame my code for another code's bugs!
Well i'm sorry but i was under the impression this was the bug thread for the script that was released there...if your code is better why not work with the one who originally scripted it and update it on the script db?

I will edit out your quote in my previous post so the owner of the script can take it as a bugreport and request for his...
RE: Capital letter & a dot by Jellings on 07-04-2006 at 04:22 PM

would it be possible to add a command or shortcut that would disabe the script for that message only?


RE: Capital letter & a dot by Farkie on 07-04-2006 at 10:21 PM

code:
function OnEvent_ChatWndSendMessage(pChatWnd, sMessage){

lastchar = sMessage.substr(sMessage.length-1, sMessage.length);

switch(lastchar) {
case '?':
    haschar = 1;
    break;
case '}':
    haschar = 1;
    break;
case ')' :
    haschar = 1;
    break;
default:
    haschar = 2;
    break;
}

firstchar = sMessage.substr(0,1);

if(firstchar == '/') {
haschar = 4;
}

firstthree = sMessage.substr(0,7);

if(firstthree == '(!nor) ') {
haschar = 3;
}

if(haschar == '1') {
    sMessage = sMessage.substr(0,1).toUpperCase() + sMessage.substr(1);
} else if (haschar == '2') {
    sMessage = sMessage.substr(0,1).toUpperCase() + sMessage.substr(1) + '.';
} else if (haschar == '3') {
    sMessage = sMessage.substr(7);
}
     return sMessage;
}



I was working on a script like this lol, never realeased it though..

Usage:
(!nor) text - produces: text
text - produces: Text.
text? - produces: Text? (example a question)
text} - produces: Text} (example showing code)
text) - produces: Text) (most emoticons!)
/command parameter - produces: (result from command)

Hows that :)
RE: Capital letter & a dot by AmbulanceX on 07-08-2006 at 03:27 PM

thing that sucks with this is if u try to use commands they dont work.. eg: doing one of these /stealdp ends up as /stealdp. and wont work. so u have to go to the effort od turning capital letter and a dot script off...


RE: Capital letter & a dot by AmbulanceX on 07-08-2006 at 04:03 PM

yeah that one annoys me, its nice to look formal in messaging, but with a fullstop after a questionmark you seem uneducated :)


RE: Capital letter & a dot by XAaronX on 07-29-2006 at 02:38 AM

Can only be capital letter? Remove the dot at the end?