Shoutbox

Case talker - 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)
+----- Forum: Plug-Ins (/forumdisplay.php?fid=28)
+------ Thread: Case talker (/showthread.php?tid=31680)

Case talker by Grinder911 on 09-18-2004 at 08:36 PM

How simple would it be to make a talker that converts uppercase characters to lowercase?

At my work everything is in uppercase so I'm constantly having to change back and forth so my contacts don't think I'm yelling at them.

I'll also forget to change back so when I start entering parts or invoicing a customer, I end up having to delete a lot of text by the time I notice.

I'm sure a talker like this would be very simple to write but It wouldn't be useful to very many people.

Any suggestions?


RE: Case talker by Grinder911 on 09-18-2004 at 08:50 PM

Thanx. I think I've almost got it figured out.


RE: Case talker by Martijn. on 09-18-2004 at 09:54 PM

I've made this some time ago, when I needed it myself:).

Don't look into it yet if you want to find out how to do it by yourself:).


RE: Case talker by Grinder911 on 09-18-2004 at 10:47 PM

I altered the talker.alternating.vbs and came up with this:

Function talker(input)
    For i = 1 To Len(input)
        keyvalue = Asc(Mid(input, i, 1))
        If (keyvalue >= 96 And keyvalue < 96 + 27) Or (keyvalue >= 64 And keyvalue < 64 + 27) Then
            If (i And 1) = 1 Then
                If keyvalue < 96 Then
                    s = s & Chr(96 + keyvalue - 64)
                Else
                    s = s & Chr(64 + keyvalue - 96)               
                End If
            Else
                If keyvalue >= 96 Then
                    s = s & Chr(64 + keyvalue - 96)
                Else
                    s = s & Chr(96 + keyvalue - 64)
                End If
            End If
    Else
            s = s & Chr(keyvalue)
        End If
    Next
    input = s&""
    talker = input
End Function

Can you see anything I don't need in there?

Then I altered talker.lafrican.js and came up with this:

var inchars="abcdefghijklmnopqrstuvwxyz";
var outchars="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

function talker(input) {
    var i=0;
    var output="";
    while (i<input.length) {
        var letter=input.substr(i,1);
        var upr=0;
        if (letter >= 'a' && letter <= 'z') {
            letter=outchars.charAt(inchars.indexOf(letter));
        }
        else
        if (letter >= 'A' && letter <= 'Z') {
            letter=inchars.charAt(outchars.indexOf(letter));
        }
        output=output+letter;
        i=i+1;
    }
    return output;
}

With the .js one everything works and the .vbs one the @ symbol and ` symbol are switched.


RE: Case talker by Grinder911 on 09-19-2004 at 12:10 AM

I was able to figure out the simple version but I wanted to add the option of using a capital letter by typing a lowercase one.

Pretty much what I wanted was something that would swap both cases - lower to upper and upper to lower.


RE: Case talker by CookieRevised on 09-19-2004 at 01:35 AM

Similar in VBScript:

Function talker(input)
  Dim i, Str, Char
  Str = ""
  For i = 1 To Len(input)
    Char = Mid(input, i, 1)
    If Char = LCase(Char) Then
      Char = UCase(Char)
    ElseIf Char = UCase(Char) Then
      Char = LCase(Char)
    End If
    Str = Str & Char
  Next
  talker = Str
End Function

This will change "This is a tëst - Ë" into "tHIS IS A TËST - ë" (note that ë, í, ô, etc. can also be upper/lowercased, these will be converted correctly also!)


RE: Case talker by Mike on 09-19-2004 at 06:10 AM

Uhhhh try this:

code:
Function talker(input)

If input = UCase(input) Then
talker = LCase(input)
Else
talker = talker
End if
End Function
Copy and paste this into notepad then save it with the name talker.lowercase.vbs in your stuff-plug.
quote:
Originally posted by CookieRevised
Dim i, Str, Char
Note!: This will declare the variables as variant!
They should be like this: Dim i as integer, Str As string, Char As string
But i dont know much vbscript...

RE: Case talker by CookieRevised on 09-19-2004 at 10:32 AM

quote:
Originally posted by Mike2
Copy and paste this into notepad then save it with the name talker.lowercase.vbs in your stuff-plug.
Do NOT... This will NOT work.
1) IF it worked, then the only thing that will do is lower casing the whole string but ONLY if the whole string was uppercased. If he pressed Shift for the first letter (and thus he has something like "hOW ARE YOU") then the function will return just the same...
2) "talker = talker" ? You can't do that (in any language).

quote:
Originally posted by Mike2
Note!: This will declare the variables as variant!
They should be like this: Dim i as integer, Str As string, Char As string.
No... wrong.
1) If you don't use Dim then the variables are declared as variants anyway! But omitting the Dim statement in your projects is a bad habit.
2) Furthermore, variables in VBScript are always of the variant type
3) declaring a variable "dim x as y" is invalid in VBScript because of this and will produce an error...

quote:
Originally posted by Mike2
But i dont know much vbscript...
(or programming it seems) (edit: uncalled for) Then do NOT suggest things, both your script and comments consist of errors.

RE: Case talker by CookieRevised on 09-19-2004 at 12:23 PM

quote:
Originally posted by TheBlasphemer
So, he's right, and now you try to talk yourself out of it with this crappy argument?
That argument isn't crap at all and is 100% correct.
1) not declaring variables in the beginning of a project is a bad habit.
2) thus I declared them.
3) of course they are variants, because vbscript only knows variant types in this case.
4) the first point was a general programming point (for vb(script)) . This has nothing todo with me trying to talk out of something because I don't need to talk me out of something in the first place!



Instead of flaming me and calling me uncalled-for names, proof me 1 thing in that post that is wrong.

And fyi, I DO know my shit I try to help with... unlike you who only seems to know how to bitch on people, flame them, call them n00bs, etc.., unless they woreship you like a god. (so look up what "arrogant" exactly means before you use that word)