PDA

View Full Version : VB6 Ascii Text genirator



Mentor
23-01-2007, 01:49 PM
Ok, to be honest this is actually a half written example script i wrote to prove to someone on a different forum, that creating an "ascii" text generator didn't require any loops. it spread from an argument over how exactly it classified as an ascii text generator since the original text entered was ascii text to start with. And im really just posting it here for the hell of it as this forums a bit empty.

Basically what it does is you type a letter in to a text box, and that letters comes out as a different ascii symbol, that looks similar to the original letter but isnt it.

To set up:
Create a text input on the form, with the name "ChangeMe" (no quotes)
Add this to the source

Private Sub ChangeMe_KeyPress(KeyAscii As Integer)
'Check they are in selected range
Select Case KeyAscii
Case 65 To 90 ' upper case
Case 96 To 122 ' lower case (make Upper)
KeyAscii = KeyAscii - 32
Case 8 ' backspace
Case 32 ' Space
Case Else 'Denyed. Beep to tell em they did somthing wrong
Beep
KeyAscii = 0
End Select
If KeyAscii <> 0 Then
'if its in range, run transform
Select Case KeyAscii
Case 65 'a
KeyAscii = 229
Case 66 'b
KeyAscii = 223
Case 67 'c
KeyAscii = 169
Case 68 'd
KeyAscii = 208
Case 69 'e
KeyAscii = 233
Case 70 'f
'And so on
Case 71 'g
Case 72 'h
Case 73 'i
Case 74 'j
Case 75 'k
Case 76 'l
Case 77 'm
Case 78 'n
Case 79 'o
Case 80 'p
Case 81 'q
Case 82 'r
Case 83 's
Case 84 't
Case 85 'u
Case 86 'v
Case 87 'w
Case 88 'x
Case 89 'y
Case 90 'z
End Select
'anything not in array with not be touched
End If
End Sub

It currently only works for the first 5 letters of the alphabet.
If anyone wants to use it, or possibly even finish it off, aka finish the case conversion part, so it will actually work for more letters (just copy what ive done already, just use different ascii values, you'd need to look em up in an ascii table of some sort.)

Anyway.. urmm... yea, thats it lol (can you tell i aint slept?)

ZAG
26-01-2007, 10:00 PM
I suppose it could we useful to something when finished. Nice for you to post it though.

Mentor
27-01-2007, 03:22 PM
Possible, although im pretty sure its still completly useless lol, although i have now added all the charicters i could find alternatives to (i was bored)


Private Sub ChangeMe_KeyPress(KeyAscii As Integer)
'Check they are in selected range
Select Case KeyAscii
Case 65 To 90 ' upper case
Case 96 To 122 ' lower case (make Upper)
KeyAscii = KeyAscii - 32
Case 8 ' backspace
Case 32 ' Space
Case Else 'Denyed. Beep to tell em they did somthing wrong
Beep
KeyAscii = 0
End Select
If KeyAscii <> 0 Then
'if its in range, run transform
Select Case KeyAscii
Case 65 'a
KeyAscii = 229
Case 66 'b
KeyAscii = 223
Case 67 'c
KeyAscii = 169
Case 68 'd
KeyAscii = 208
Case 69 'e
KeyAscii = 233
Case 70 'f
Case 71 'g
Case 72 'h
Case 73 'i
KeyAscii = 33
Case 74 'j
Case 75 'k
Case 76 'l
KeyAscii = 166
Case 77 'm
Case 78 'n
KeyAscii = 241
Case 79 'o
KeyAscii = 216
Case 80 'p
KeyAscii = 254
Case 81 'q
Case 82 'r
KeyAscii = 174
Case 83 's
KeyAscii = 167
Case 84 't
KeyAscii = 43
Case 85 'u
KeyAscii = 220
Case 86 'v
Case 87 'w
Case 88 'x
KeyAscii = 215
Case 89 'y
KeyAscii = 165
Case 90 'z
End Select
'anything not in array with not be touched
End If
End Sub

Want to hide these adverts? Register an account for free!