program builder Posted June 3, 2009 Share Posted June 3, 2009 A message decoder, that if I type a string of characters into an input box, and press enter; it will give numbers in a messagebox, that needs to be typed inorder to view the characters in a messagebox again that were acually typed. like 456378 = A 59876089 = B ext. with maybe a dot to seperate numbers 456378.59876089 if anybody can help please let me know. Link to comment Share on other sites More sharing options...
Valuater Posted June 3, 2009 Share Posted June 3, 2009 straight from help... expandcollapse popup#include <GuiConstantsEx.au3> #include <String.au3> Opt("MustDeclareVars", 1) _Main() Func _Main() Local $WinMain, $EditText, $InputPass, $InputLevel, $UpDownLevel, $EncryptButton, $DecryptButton, $string ; GUI and String stuff $WinMain = GUICreate('Encryption tool', 400, 400) ; Creates window $EditText = GUICtrlCreateEdit('', 5, 5, 380, 350) ; Creates main edit $InputPass = GUICtrlCreateInput('', 5, 360, 100, 20, 0x21) ; Creates the password box with blured/centered input $InputLevel = GUICtrlCreateInput(1, 110, 360, 50, 20, 0x2001) $UpDownLevel = GUICtrlSetLimit(GUICtrlCreateUpdown($InputLevel), 10, 1) ; These two make the level input with the Up|Down ability $EncryptButton = GUICtrlCreateButton('Encrypt', 170, 360, 105, 35) ; Encryption button $DecryptButton = GUICtrlCreateButton('Decrypt', 285, 360, 105, 35) ; Decryption button GUICtrlCreateLabel('Password', 5, 385) GUICtrlCreateLabel('Level', 110, 385) ; Simple text labels so you know what is what GUISetState() ; Shows window While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $EncryptButton GUISetState(@SW_DISABLE, $WinMain) ; Stops you from changing anything $string = GUICtrlRead($EditText) ; Saves the editbox for later GUICtrlSetData($EditText, 'Please wait while the text is Encrypted/Decrypted.') ; Friendly message GUICtrlSetData($EditText, _StringEncrypt(1, $string, GUICtrlRead($InputPass), GUICtrlRead($InputLevel))) ; Calls the encryption. Sets the data of editbox with the encrypted string ; The encryption starts with 1/0 to tell it to encrypt/decrypt ; The encryption then has the string that we saved for later from edit box ; It then reads the password box & Reads the level box GUISetState(@SW_ENABLE, $WinMain) ; This turns the window back on Case $DecryptButton GUISetState(@SW_DISABLE, $WinMain) ; Stops you from changing anything $string = GUICtrlRead($EditText) ; Saves the editbox for later GUICtrlSetData($EditText, 'Please wait while the text is Encrypted/Decrypted.') ; Friendly message GUICtrlSetData($EditText, _StringEncrypt(0, $string, GUICtrlRead($InputPass), GUICtrlRead($InputLevel))) ; Calls the encryption. Sets the data of editbox with the encrypted string ; The encryption starts with 1/0 to tell it to encrypt/decrypt ; The encryption then has the string that we saved for later from edit box ; It then reads the password box & Reads the level box GUISetState(@SW_ENABLE, $WinMain) ; This turns the window back on EndSwitch WEnd ; Continue loop untill window is closed Exit EndFunc ;==>_Main 8) Link to comment Share on other sites More sharing options...
program builder Posted June 3, 2009 Author Share Posted June 3, 2009 (edited) ;I need a standard size input box, the size that is in the autoit examples. and I also need it to where it uses numbers for codes. and I do not need a passcode. ;does anybody know how I can turn this into what I want to do? like I said, decodes with numbers. $C1=StringSplit("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 .!?,","") $C2=StringSplit("ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba9876543210 .!?,","") $Input=InputBox ("EasyCoder","Please enter text to be Encoded\Decoded") If @Error=1 Then Exit $Text=StringSplit($Input,"") Dim $NewText For $CurrentPos=1 to $Text[0] $Char=$Text[$CurrentPos] $CharPos=ArraySearch ($C1,$Char) If $CharPos="X" then ContinueLoop $NewChar=$C2[$CharPos] $NewText=$NewText & $NewChar Next ClipPut ($NewText) MsgBox (0,"EasyCoder",$NewText) Func ArraySearch ($Array,$What2Find) For $X=1 to $Array[0] If $Array[$X]==$What2Find then Return $X Next Return "X" EndFunc Edited June 3, 2009 by program builder Link to comment Share on other sites More sharing options...
program builder Posted June 3, 2009 Author Share Posted June 3, 2009 ;Does anybody know why the script below isn't working? I am trying to get it to work with numbers. $C1=StringSplit("A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v |w|x|y|z|0|1|2|3|4|5|6|7|8|9 .!?,","") $C2=StringSplit("1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35 |36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|.|!|?|,","") $Input=InputBox ("EasyCoder","Please enter text to be Encoded\Decoded") If @Error=1 Then Exit $Text=StringSplit($Input,"") Dim $NewText For $CurrentPos=1 to $Text[0] $Char=$Text[$CurrentPos] $CharPos=ArraySearch ($C1,$Char) If $CharPos="X" then ContinueLoop $NewChar=$C2[$CharPos] $NewText=$NewText & $NewChar Next ClipPut ($NewText) MsgBox (0,"EasyCoder",$NewText) Func ArraySearch ($Array,$What2Find) For $X=1 to $Array[0] If $Array[$X]==$What2Find then Return $X Next Return "X" EndFunc Link to comment Share on other sites More sharing options...
Valuater Posted June 3, 2009 Share Posted June 3, 2009 I got this to work for encryption and decryption expandcollapse popupDim $Num $C1 = StringSplit("A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u" & _ "|v|w|x|y|z|0|1|2|3|4|5|6|7|8|9| |.|!|?|", "|") $C2 = StringSplit("1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35" & _ "|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|.|!|?|", "|") $Input = InputBox("EasyCoder", "Please enter text to be Encoded\Decoded") If @error = 1 Then Exit If StringIsAlNum(StringReplace($Input, "|", "")) Then $Num = True $Text = StringSplit($Input, "|") Else $Text = StringSplit($Input, "") EndIf Local $NewText = "" For $CurrentPos = 1 To $Text[0] $Char = $Text[$CurrentPos] If $Num Then $CharPos = ArraySearch($C2, $Char) If $CharPos = False Then ContinueLoop $NewChar = $C1[$CharPos] Else $CharPos = ArraySearch($C1, $Char) If $CharPos = False Then ContinueLoop $NewChar = $C2[$CharPos] & "|" EndIf $NewText = $NewText & $NewChar Next ClipPut($NewText) InputBox("EasyCoder", "Please copy your code", $NewText) Func ArraySearch($Array, $What2Find) For $X = 1 To UBound($Array) - 1 If $Array[$X] == $What2Find Then Return $X Next Return False EndFunc ;==>ArraySearch 8) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now