Sign in to follow this  
Followers 0
Hello Me You

Replacing Characters

15 posts in this topic

#1 ·  Posted (edited)

That I want is simple. I want a window [GUI] that has two input boxes and a button between them. Like this:

________________________

|:::::::::::::::::::::::::::::::::::::|

|::::::::::: Input Box 1 ::::::::::|

|:::::::::::::::::::::::::::::::::::::|

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

______________

|::::: Button :::::|

¯¯¯¯¯¯¯¯¯¯¯¯¯¯

________________________

|:::::::::::::::::::::::::::::::::::::|

|::::::::::: Input Box 2 ::::::::::|

|:::::::::::::::::::::::::::::::::::::|

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

When you enter text in one of the boxes and click the button it will replace the characters.

"Translated" characters will appear in the input box 2. But I want and something else. I need this to talk with a friend in msn with encrypted characters, so when I enter a text and click the button, I will get translated text. Then I will send (copy & paste) the text to my friend. So, when he copy & paste the encrypted text in the input box 2 and click the button he will get back the normal text in input box 1.

I hope you understand. Thank you.

Please Scroll Down

Edited by Hello Me You

Random

Share this post


Link to post
Share on other sites



That I want is simple. I want a window [GUI] that has two input boxes and a button between them. Like this:

When you enter text in one of the boxes and click the button it will replace the characters.

"Translated" characters will appear in the input box 2. But I want and something else. I need this to talk with a friend in msn with encrypted characters, so when I enter a text and click the button, I will get translated text. Then I will send (copy & paste) the text to my friend. So, when he copy & paste the encrypted text in the input box 2 and click the button he will get back the normal text in input box 1.

I hope you understand. Thank you.

Use koda for the GUI, and then use "StringReplace()" for the characters.

Note, if you want it to decrypt too, then you'll probably want 2 buttons

and i think its Editboxes you would want, not inputboxes.

I'd be happy to help more, but i'm not getting my feet wet till you do.

Share this post


Link to post
Share on other sites

CODE

That I want is simple. I want a window [GUI] that has two input boxes and a button between them. Like this:

________________________

|:::::::::::::::::::::::::::::::::::::|

|::::::::::: Input Box 1 ::::::::::|

|:::::::::::::::::::::::::::::::::::::|

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

______________

|::::: Button :::::|

¯¯¯¯¯¯¯¯¯¯¯¯¯¯

________________________

|:::::::::::::::::::::::::::::::::::::|

|::::::::::: Input Box 2 ::::::::::|

|:::::::::::::::::::::::::::::::::::::|

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

When you enter text in one of the boxes and click the button it will replace the characters.

"Translated" characters will appear in the input box 2. But I want and something else. I need this to talk with a friend in msn with encrypted characters, so when I enter a text and click the button, I will get translated text. Then I will send (copy & paste) the text to my friend. So, when he copy & paste the encrypted text in the input box 2 and click the button he will get back the normal text in input box 1.

I hope you understand. Thank you.

... And? I see no question here...

So, in other words (If I'm reading this correctly, and based off all of your other leach request, I doubt I'm not), you're too lazy to do any of the initial work (you know, searching for MSN on the search option, using the GFI (GUI for Idiots (Lookfar and Lazycat spent a lot of time to idiot proof GUI making for those of you that are too lazy to actually learn how to make them or what the functions actually do)) to build your GUI that you are describing above, or even looking in the help file (what a concept) for "Encryption" + "Strings" (might have found _StringEncrypt)).

With that in mind, if you're asking for direction, I suggest the quickest route to fixing your issue is pulling the power coord on your PC and chalk the scripting experience up as another failed attempt of achieving something in life.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Well, he didnt ask for us to do anything either...

Maybe hes just looking for some advice, but yeah sometimes its best to try it out first before letting the world know your idea

But "Hello Me You" what are you looking for? I have made converters (Like binary/hex and stuff), and simple encrypters... Its not that hard with Au3

Also, i dont like your name... I cant greet you Hello Hello Me You! Its just not right...

Share this post


Link to post
Share on other sites

i just don't know how to replace characters and show them in input box 2


Random

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

i just don't know how to replace characters and show them in input box 2

Look at GuiCtrlSetData(). :whistle:

Edit: Oh, use GuiCtrlRead() to get the text and use StringReplace() to change and then use above advice.

Edited by MHz

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Hey MHz

Ok, but I can't understand how StringReplace() works

Edited by Hello Me You

Random

Share this post


Link to post
Share on other sites

Hey MHz

Ok, but I can't understand how StringReplace() works

Straight from the help.

$String1 = "This is a line of text"
$String2 = StringReplace($String1, " ", "-");Replaces all "spaces" with "-"
MsgBox(0, "New string is", $String2)

Basically, its this:

StringReplace($TheStringYouWantToEdit, $TheCharacterOrPhraseToReplace, $WhatYouWantToReplaceItWith)

Share this post


Link to post
Share on other sites

Thanks Paulie


Random

Share this post


Link to post
Share on other sites

I am stuck, I don't know how to continue. Can anyone help me?

What do I have to do so it will encrypt the text. (for example I want to replace "a" with "1", "b" with "2" and "c" with "3")

Here is my source:

#include <GuiConstants.au3>

GuiCreate("Encryptor", 400, 270, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$normal_text = GuiCtrlCreateInput("", 10, 10, 380, 100)
$encrypt_text = GuiCtrlCreateInput("", 10, 160, 380, 100)

$text1 = GUICtrlRead($normal_text)
$text2 = GUICtrlRead($encrypt_text)

$encrypt_btn = GuiCtrlCreateButton("Encrypt", 10, 120, 100, 30)
$decrypt_btn = GuiCtrlCreateButton("Decrypt", 290, 120, 100, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $encrypt_btn
        ;???
    Case $msg = $decrypt_btn
        ;???
EndSelect
WEnd
Exit

Random

Share this post


Link to post
Share on other sites

I am stuck, I don't know how to continue. Can anyone help me?

What do I have to do so it will encrypt the text. (for example I want to replace "a" with "1", "b" with "2" and "c" with "3")

What about capital letters? would the be different?

Share this post


Link to post
Share on other sites

What is the difference? I can add more characters to replace later, can't I?


Random

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

What is the difference? I can add more characters to replace later, can't I?

Here is a sample for you.

Its not that hard to figure out, but if you want a more complex form of encryption, then you are on your own for an algorithm.

Note: this does not recognize capital letters So it you encrypt "PAULIE", then decrypt what you get, you will get "paulie"

#include <GuiConstants.au3>

GuiCreate("Encryptor", 400, 270, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$normal_text = GuiCtrlCreateInput("", 10, 10, 380, 100)
$encrypt_text = GuiCtrlCreateInput("", 10, 160, 380, 100)


$encrypt_btn = GuiCtrlCreateButton("Encrypt", 10, 120, 100, 30)
$decrypt_btn = GuiCtrlCreateButton("Decrypt", 290, 120, 100, 30)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $encrypt_btn
        $text1 = GUICtrlRead($normal_text)
        $Text1_New = _Encrypt($Text1)
        GUICtrlSetData($encrypt_text, "")
        GUICtrlSetData($encrypt_text, $Text1_New)
    Case $msg = $decrypt_btn
        $text2 = GUICtrlRead($encrypt_text)
        $Text2_New = _Decrypt($Text2)
        GUICtrlSetData($normal_text, "")
        GUICtrlSetData($normal_text, $Text2_New)
EndSelect
WEnd
Exit

Func _Encrypt($s_Text)
    Local $NewString[30],$Number = 0
    $NewString[0] = $S_Text 
    For $n = 97 To 123
        If StringInStr($S_Text, Chr($n)) Then
            $Number += 1 
            $NewString[$Number] = StringReplace($NewString[$number-1], Chr($n), $n-96&"-")
        EndIf
    Next
    Return StringTrimRight($NewString[$Number],1)
EndFunc
    
Func _Decrypt($s_Text)
    $Split = StringSplit($S_Text,"-")
    $String= ""
    For $i = 1 to $Split[0]
        $String = $String& Chr($Split[$i]+96)
    Next
    Return $String
EndFunc
Edited by Paulie

Share this post


Link to post
Share on other sites

Jesus... ya'll did it anyway... he played you question by question, and you wrote it for him anyway.

GUI by GFI

The rest by Paulie... nice.

Now Paulie, how does he get that to work with MSN? That's his last question.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Thanks Paulie


Random

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0