roeselpi Posted March 6, 2019 Posted March 6, 2019 (edited) hello everybody. i am an absolute beginner and have zero experience with programming and / or scripting. i have been looking at autoit for about one week and thus do not know and / or understand a lot about it. but: i have started writing a programe. i have not got very far yet, but many hours of tutorial watching and trying out things has brought me to where i am now. to be honest, i did not even think that i would make it this far. trial and error all the way. but i am quite happy to say that my programe works... well... all apart from the most important two functions. but i have given it a good shot and come to the point where my understanding is limited for what i want to do and thus i would need the help of a coding-expert. to make a long story short i will show what i have got... i guess everything can be copy and pasted apart from the image. it is just an example image but i will upload it anyway. 1. make a simple text file and save it as "test.txt" with the following text within it: Hammurabi walks into the forest @ 5 o'clock. 2. make a simple text file and save it as "illogic.ini" with the following text within it: [alternation] alter=2,4,1 ;- 0 for NO alternation [spacing] steps=3 ;- aplies only if alternation is 0 ;- disable function with 0 but alternation must then aply [syntax] syntax=3,5,2 ;- 0 for RANDOM choice [symbols] symbs=a,b,c,d,e,f,g,h,i,j,k,0,1,2,3,4,5,6 ;- symbols to be used in scramble routine 3. save the image as "illogic.jpg" together with the other two files in order to have the same as me in one directory (illogic). or edit the au3 code to match with the rest. 4. save the au3 code below as "illogic.au3" in the same directory. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> $ini = "illogic.ini" $sections = IniReadSectionNames($ini) For $a = 1 To UBound($sections) - 1 $keys = IniReadSection($ini, $sections[$a]) For $b = 1 To UBound($keys) - 1 ; ConsoleWrite($keys[$b][1] & @CRLF) ; ShellExecute(IniRead($ini, $sections[$a], $keys[$b][0], "")) Next Next #Region ### START Koda GUI section ### Form=C:\AutoIt3\illogic\illogic-mask.kxf Global $Navigation = GUICreate("illogic - the illogical scrambler", 1002, 653, -1, -1) Global $File = GUICtrlCreateMenu("&File") Global $NewFile = GUICtrlCreateMenuItem("New File", $File) Global $OpenFile = GUICtrlCreateMenuItem("Open File", $File) Global $SaveAs = GUICtrlCreateMenuItem("Save as...", $File) Global $Exit = GUICtrlCreateMenuItem("Exit", $File) Global $etc = GUICtrlCreateMenu("?") Global $About = GUICtrlCreateMenuItem("About", $etc) Global $scramble = GUICtrlCreateButton("ILLOGIC", 48, 568, 145, 33) Global $descramble = GUICtrlCreateButton("LOGIC", 240, 568, 145, 33) Global $exiteer = GUICtrlCreateButton("EXIT", 808, 568, 145, 33) Global $entry = GUICtrlCreateEdit("", 40, 128, 921, 417) GUICtrlSetData(-1, "Empty File...") GUICtrlSetBkColor(-1, 0xE3E3E3) Global $Pic1 = GUICtrlCreatePic("C:\AutoIt3\illogic\illogic.jpg", 40, 16, 921, 89) Global $reset = GUICtrlCreateButton("RESET", 432, 568, 147, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Global $exitbutton $exitbutton = MsgBox(36, "Close Aplication?", "Bye For Now & See You Next Time...") If $exitbutton = 6 Then Exit Case $Exit Global $exitbutton $exitbutton = MsgBox(36, "Close Aplication?", "Bye For Now & See You Next Time...") If $exitbutton = 6 Then Exit Case $exiteer Global $exitbutton $exitbutton = MsgBox(36, "Close Aplication?", "Bye For Now & See You Next Time...") If $exitbutton = 6 Then Exit Case $About MsgBox(0,"About...","illogic v 1.0") Case $SaveAs $EntryData = GUICtrlRead($entry) $SaveLocation = FileSaveDialog("Save file", @ScriptDir, "All Files (*.*)", 16) FileWrite($SaveLocation, $EntryData) Case $NewFile GUICtrlSetData($entry, "New File...") Case $reset GUICtrlSetData($entry, "Reset...") Case $OpenFile $read = FileOpenDialog("Open File", @ScriptDir, "All Files (*.*)", 16) $text = FileRead($read, -1) GUICtrlSetData($entry, $text) FileClose($text) EndSwitch WEnd That is now a working programe. If you open the test.txt file in the programe it will copy the text into the edit box and that is where my problem starts. I would now like the two only unused buttons "illogic" and "logic" to perform what i have intended them to do and that is where the settings from the ini file become important and also the spot where i need help because being a noobie also means not understanding how to go about solving issues where there are no tutorials... Pressing "illogic" should transform (with the settings from the ini shown above) the text within the edit box like shown below: Hchaj16bmemj0u3bdgr0a25bbgi0i5wadaik2alckfks14ceihn13t6egjo tchhj16beefj0o3bdgr0e25sbgi0t5@ad5ik2aoc'fkc14celho13c6egjk3. to explain how the text got scrambled let us look at the ini file: the alternation "alter=2,4,1" describes that inbetween each letter or space there must be first two, then next four and finally one letter placed in addition to the existing text the steps "steps=3" describes that inbetween each letter or space there must be 3 additional letters placed. this only aplies when alternation=0 the syntax "syntax=3,5,2" describes which letter must be used in which order. first the 3rd letter then from there on the 5th letter and finally the 2nd letter. the symbols "symbs=a,b,c,d,e,f,g,h,i,j,k,0,1,2,3,4,5,6" describes what spacing letters can or must be used. basically the full alphabet and numerals and possibly even special chars it took about twenty minutes to do this manually because i kept getting the couting wrong. anyway, the illogic button should distort the text in accordence with the settings in the ini file and of course output it in the edit box. then the file should or could be saved as a text file. i guess you know what the "logic" button is supposed to do... yes, it is supposed to turn the mumble-jumble back into the original text. (as long as the ini file is not altered it should work) another idea was working with several ini files and adding a choice dropdown for the ini files, but that is not an absolute requirement. now to my problem: i have no idea how to carry on form the point i am at now. i have been able to read the ini values into the console but the impossible task begins now trying to make functions or variables for each parameter from the ini-file. that is where i would hope for some help from users who know what they are doing and maybe can take the time to give me a big help. i am very much hoping for helpful replies. kind regards edit: corrected some mistakes. Edited March 6, 2019 by roeselpi
roeselpi Posted March 6, 2019 Author Posted March 6, 2019 hello again. i just have been thinking about a missing point in my ini file. it might be good to alternate the cycle for every line. because starting at the beginning for each line would somehow make it a bit easier to read the distorted text if you take the time to see which letters or symbols are always in the same space and eliminate those whilst reading. that is just a thought to the general concept. kind regards
caramen Posted March 6, 2019 Posted March 6, 2019 It would be a pleasure to help you to go far as you want where you from ? Pm me. My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
roeselpi Posted March 7, 2019 Author Posted March 7, 2019 hi, maybe i must point out another thing: i do not expect anybody to finish my script for me but rather more i would need the help in understanding how to continue from the point i am at now. maybe a working example of how autoit can do complex things whilst using an ini file as a settings delivery. maybe even a finished script that i can read and try to addapt to suit my needs. i think in some tutorial video someone used a ini file with a colour in an hex format "color=255,255,255" but they did not show in the tutorial how to grab those numbers and use them to do something. another big issue would be once the grabbing of the ini values has been done to actually place the additional letters inbetween the existing ones after every letter and every space that is already there. if explainations of what does what would be within the help, that would be a great help as well. i am here to learn something and ultimatly be able to get my programe finished the way i entend it to work. i am not asking for someone to finish the script, but rather more to really help me understand what i am doing an pointing me in the right direction to be able to reach my goal. thank you. kind regards
caramen Posted March 8, 2019 Posted March 8, 2019 (edited) expandcollapse popup#include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <Array.au3> ;You extract a string into a variable. $Str = "ABC" ;You split each character from that string. $Arr = StringSplit ( $str , "" ) ;Let's check what do we got. _ArrayDisplay ($Arr) ;Now you add the wanted charactere into your splited string. ;This extra line is not needed it will replace the index 0 from our array so we're not confuse with the number 3 $Arr[0] = "" ;Let's say we want to be able to use 2 methode Global $UsedMethode = 1 ;We declare our metode in the global scope ;that will be userfull if we do a custom function with it so the value "1" will be readable inside it. ;For your understanding i'll use numbers so we can see easy what happening in our string. Local $Methode1Array [10]= [1111,2222,3333,4444,5555,6666,7777,8888,9999] Local $Methode0Array = ["9999","8888","7777","6666","5555","4444","3333","2222","1111"] $NewString = "" If $UsedMethode = 1 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines ;One solution is to make a for loop to loop on the Raws number that will allow your script to work same way even with different amount of charactere in our strings. For $i = 1 to $Raws Step 1 ;$Raws = 3 $NewString = $NewString & $Arr[$i-1] & $Methode1Array[$i-1] Next ElseIf $UsedMethode = 0 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines For $i = 0 to $Raws Step 1 ;$Raws = 3 $NewString =$NewString & $Arr[$i] & $Methode0Array [$i-1] Next EndIf ;Or ;If $UsedMethode = 1 Then ;Else ;EndIf ;Now let's try this code $usedMethode = 1 $NewString = "" ; We reset result anyway before new generation If $UsedMethode = 1 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines For $i = 1 to $Raws Step 1 ;$Arr = 3 $NewString =$NewString & $Arr[$i-1] & $Methode1Array [$i-1] Next ElseIf $UsedMethode = 0 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines For $i = 1 to $Raws Step 1 ;$Arr = 3 $NewString =$NewString & $Arr[$i-1] & $Methode0Array [$i-1] Next EndIf ;We check our string with methode 1 : MsgBox (0 , "NewString Methode1" , $NewString ) $usedMethode = 0 $NewString = "" ; We reset result anyway before new generation If $UsedMethode = 1 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines For $i = 1 to $Raws Step 1 ;$Arr = 3 $NewString =$NewString & $Arr[$i-1] & $Methode1Array [$i-1] Next ElseIf $UsedMethode = 0 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines For $i = 1 to $Raws Step 1 ;$Arr = 3 $NewString =$NewString & $Arr[$i-1] & $Methode0Array [$i-1] Next EndIf ;We check our string with methode 0 : MsgBox (0 , "NewString Methode0" , $NewString ) I did it fast the simple way for me. There is 50 possibility to do that in different way. Now i looked further, and there is a problem with this line. $NewString =$NewString & $Arr[$i-1] & $Methode1Array [$i-1] I am not checking how much time i can loop $Methode1Array [$i-1] Becose if i leave the code like that after 10 loops we will have $Methode1Array [-1] And out array dont have an index with the value -1 how can we do ? Answer in my next post. Edited March 8, 2019 by caramen Fr33b0w 1 My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
caramen Posted March 8, 2019 Posted March 8, 2019 (edited) expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.5 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <Array.au3> ;You extract a string into a variable. $Str = "Hammurabi walks into"&@CR&" the forest @ 5 o'clock." ; NOTICE HOW THE @CR is working with this line : MsgBox (0, "" , $str ) ; And NOTICE how it looks in the array : Index [21] ;You split each character from that string. $Arr = StringSplit ( $str , "" ) ;Let's check what do we got. _ArrayDisplay ($Arr) ;Now you add the wanted charactere into your splited string. ;This extra line is not needed it will replace the index 0 from our array so we're not confuse with the number 3 $Arr[0] = "" ;Let's say we want to be able to use 2 methode Global $UsedMethode = 1 ;We declare our metode in the global scope ;that will be userfull if we do a custom function with it so the value "1" will be readable inside it. ;But not necessary in our code actually. ;For your understanding i'll use numbers so we can see easy what happening in our string. Local $Methode1Array = [1111,2222,3333,4444,5555,6666,7777,8888,9999] Local $Methode0Array = ["9999","8888","7777","6666","5555","4444","3333","2222","1111"] $SecondIndex = UBound ($Methode1Array) $NewString = "" Global $b=$SecondIndex MsgBox(0,"How much lines got $Methode1Array ?", $b ) MsgBox(0,"How much lines got $Methode1Array -1 ?", $Methode1Array[$b-1] ) If $UsedMethode = 1 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines ;One solution is to make a for loop to loop on the Raws number that will allow your script to work same way even with different amount of charactere in our strings. For $i = 1 to $Raws Step 1 ;$Raws = 3 $b -= 1 If $b = 0 Then $b = $SecondIndex ; This is how we manage random amount of characteres with your algorythm $NewString = $NewString & $Arr[$i-1] & $Methode1Array[$b-1] Next ElseIf $UsedMethode = 0 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines For $i = 0 to $Raws Step 1 ;$Raws = 3 $b -= 1 If $b = 0 Then $b = $SecondIndex ; This is how we manage random amount of characteres with your algorythm $NewString = $NewString & $Arr[$i-1] & $Methode0Array[$b-1] Next EndIf ;Or ;If $UsedMethode = 1 Then ;Else ;EndIf ;Now let's try this code $usedMethode = 1 $NewString = "" ; We reset result anyway before new generation If $UsedMethode = 1 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines For $i = 1 to $Raws Step 1 ;$Arr = 3 $b -= 1 If $b = 0 Then $b = $SecondIndex ; This is how we manage random amount of characteres with your algorythm $NewString = $NewString & $Arr[$i-1] & $Methode1Array[$b-1] Next ElseIf $UsedMethode = 0 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines For $i = 1 to $Raws Step 1 ;$Arr = 3 $b -= 1 If $b = 0 Then $b = $SecondIndex ; This is how we manage random amount of characteres with your algorythm $NewString = $NewString & $Arr[$i-1] & $Methode0Array[$b-1] Next EndIf ;We check our string with methode 1 : MsgBox (0 , "NewString Methode1" , $NewString ) $usedMethode = 0 $NewString = "" ; We reset result anyway before new generation If $UsedMethode = 1 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines For $i = 1 to $Raws Step 1 ;$Arr = 3 $b -= 1 If $b = 0 Then $b = $SecondIndex ; This is how we manage random amount of characteres with your algorythm $NewString = $NewString & $Arr[$i-1] & $Methode1Array[$b-1] Next ElseIf $UsedMethode = 0 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines For $i = 1 to $Raws Step 1 ;$Arr = 3 $b -= 1 If $b = 0 Then $b = $SecondIndex ; This is how we manage random amount of characteres with your algorythm $NewString = $NewString & $Arr[$i-1] & $Methode1Array[$b-1] Next EndIf ;We check our string with methode 0 : MsgBox (0 , "NewString Methode0" , $NewString ) Now do a new AU3 file. Past this and try it. After you see the result you try to read all my code and understand line by line. See you later i am here for you if you have questions. I am curius now please explain us what is the final goal of your script. Are you making secret messenger 😛 or what ever ? Edited March 8, 2019 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
roeselpi Posted March 11, 2019 Author Posted March 11, 2019 hello, sorry for the late reply. i have just copied your example and just gave it a test-run and that already looks great. the coments will help me to understand what needs to be done. it looks fantastic. many thanks for that. i will probably have many questions yet and will be asking them soon. so stay tuned for that... to answer your question: Quote I am curius now please explain us what is the final goal of your script. Are you making secret messenger 😛 or what ever ? no, nothing as complicated as that. originally i got the basic idea from an old board-game called "outburst" i will add some images. outburst-the-game.jpg = the actual game outburst-cards.jpg = the encoded cards (plain text hardly readable becaue of layers of red colour over the actual text) outburst-card-readable.jpg = the interface with red glass that makes everything readable at once. as you can see in outburst you "encode" text by layering a red colour over the plain text and when you use a interface that has a red glass, then you can read the text clearly. now my project does basically the same. it should turn a plain readable text into something that only someone can read who knows exactly what to look for. it is basically an encryption without the use of complicated and not understandable encrypting software. i came up with the idea to "encode" text files when taking them on a usb-stick or when being on a computer that several people use. only he who knows what to look for can read what the text is and does not need complicated encryption software because it is still plain text and readable for everyone but just does not make sense to the reader. simple. i shall return with my questions in the near future. thanks a million for the push in the right direction. kind regards
caramen Posted March 12, 2019 Posted March 12, 2019 (edited) So basically there is something like a secret string xD. Well sound like fun but if you forget your routine it will be hard to read everything back 😛 . Discord Quote: the imputed text "hammurabi walks into..." will always change The code is made for that. After you arrived at the end of your Methode it will roll back to the beginning. And start again to shuffle letter from start. Try with different words. and must be copied from the editbox You just have to manage this from a GUI But as i can see you already made it. You just have to readapt my code and take my logic. But as I almost always say there is 50 ways to do what you want to do. Edited March 12, 2019 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
caramen Posted March 12, 2019 Posted March 12, 2019 (edited) Look you will like this. This is the next level : User Defined Function with your idea/project : expandcollapse popupGlobal $UsedMethode Global $Methode0Array = ["@@1@@","@@2@@","@@3@@","@@4@@","@@5@@","@@6@@","@@7@@","@@8@@","@@9@@"] $FirstIndex = UBound ($Methode0Array) Global $NewString = "" Global $a = $FirstIndex Global $Methode1Array = ["--1--","--2--","--3--","--4--","--5--","--6--","--7--","--8--","--9--"] $SecondIndex = UBound ($Methode1Array) Global $NewString = "" Global $b = $SecondIndex Func _NewString ($Str) $NewString = "" $Arr = StringSplit ( $Str , "" ) $Arr[0] = "" If $UsedMethode = 1 Then $Raws = UBound ($Arr) For $i = 1 to $Raws Step 1 $b -= 1 If $b = 0 Then $b = $SecondIndex $NewString = $NewString & $Arr[$i-1] & $Methode1Array[$b-1] Next ElseIf $UsedMethode = 0 Then $Raws = UBound ($Arr) For $i = 1 to $Raws Step 1 $a -= 1 If $a = 0 Then $a = $FirstIndex $NewString = $NewString & $Arr[$i-1] & $Methode0Array[$b-1] Next EndIf Return $NewString EndFunc $UsedMethode = 0 $Test = _NewString ("I am learning how to code with AutoIT") MsgBox (0 ,"$ScambledString is equal to ;" , ""&$Test ) $UsedMethode = 1 $Test2 = _NewString ("Caramen is a noob !") MsgBox (0 ,"$ScambledString is equal to ;" , ""&$Test2 ) $UsedMethode = 0 $Test2 = _NewString ("I love too much every girl to think about guys") MsgBox (0 ,"$ScambledString is equal to ;" , ""&$Test2 ) expandcollapse popupGlobal $UsedMethode Global $Methode0Array = ["@@1@@","@@2@@","@@3@@","@@4@@","@@5@@","@@6@@","@@7@@","@@8@@","@@9@@"] $FirstIndex = UBound ($Methode0Array) Global $NewString = "" Global $a = $FirstIndex Global $Methode1Array = ["--1--","--2--","--3--","--4--","--5--","--6--","--7--","--8--","--9--"] $SecondIndex = UBound ($Methode1Array) Global $NewString = "" Global $b = $SecondIndex ;~ ======================= ;~ ======================= ;~ EXTRA METHODE CAN BE ADDED NOW AND EASY : Global $MethodeXXXArray = ["##1##","##2##","##3##"] $ThirdIndex = UBound ($MethodeXXXArray) Global $c = $ThirdIndex ;~ ======================= ;~ ======================= Func _NewString ($Str) $NewString = "" $Arr = StringSplit ( $Str , "" ) $Arr[0] = "" If $UsedMethode = 1 Then $Raws = UBound ($Arr) For $i = 1 to $Raws Step 1 $b -= 1 If $b = 0 Then $b = $SecondIndex $NewString = $NewString & $Arr[$i-1] & $Methode1Array[$b-1] Next ElseIf $UsedMethode = 0 Then $Raws = UBound ($Arr) For $i = 1 to $Raws Step 1 $a -= 1 If $a = 0 Then $a = $FirstIndex $NewString = $NewString & $Arr[$i-1] & $Methode0Array[$b-1] Next ;~ ======================= ;~ ======================= ;~ EXTRA METHODE CAN BE ADDED NOW AND EASY : ElseIf $UsedMethode = 2 Then $Raws = UBound ($Arr) For $i = 1 to $Raws Step 1 $c -= 1 If $c = 0 Then $c = $ThirdIndex $NewString = $NewString & $Arr[$i-1] & $MethodeXXXArray[$c-1] Next ;~ ======================= ;~ ======================= EndIf Return $NewString EndFunc $UsedMethode = 0 $Test = _NewString ("I am learning how to code with AutoIT") MsgBox (0 ,"$ScambledString is equal to ;" , ""&$Test ) $UsedMethode = 1 $Test2 = _NewString ("Caramen is a noob !") MsgBox (0 ,"$ScambledString is equal to ;" , ""&$Test2 ) $UsedMethode = 2 $Test2 = _NewString ("I love too much every girl to think about guys") MsgBox (0 ,"$ScambledString is equal to ;" , ""&$Test2 ) (You dont need any include anymore for this code) Without comments the code look better and cute ^^ 😜 . Edited March 12, 2019 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
roeselpi Posted March 13, 2019 Author Posted March 13, 2019 hello again, i spent all day editing and trying the code and getting things changed in the provided code. i will show you what i have done. i have solved the issues from the gui side and that is no problem and it also works, but i found a few faults. i was just about to post them and you already replied twice more with different ideas or further additions. i will look at them maybe tonight but to show you anyway how far i have got: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <WinAPIFiles.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <Array.au3> ; $ini = "illogic.ini" ; $sections = IniReadSectionNames($ini) ; For $a = 1 To UBound($sections) - 1 ; $keys = IniReadSection($ini, $sections[$a]) ; For $b = 1 To UBound($keys) - 1 ; ConsoleWrite($keys[$b][1] & @CRLF) ; ; ShellExecute(IniRead($ini, $sections[$a], $keys[$b][0], "")) ; Next ; Next #Region ### START Koda GUI section ### Form=C:\AutoIt3\illogic\illogic-mask.kxf Global $Navigation = GUICreate("illogic - the illogical scrambler", 1002, 653, -1, -1) Global $File = GUICtrlCreateMenu("&File") Global $NewFile = GUICtrlCreateMenuItem("New File", $File) Global $OpenFile = GUICtrlCreateMenuItem("Open File", $File) Global $SaveAs = GUICtrlCreateMenuItem("Save as...", $File) Global $Exit = GUICtrlCreateMenuItem("Exit", $File) Global $etc = GUICtrlCreateMenu("?") Global $About = GUICtrlCreateMenuItem("About", $etc) Global $scramble = GUICtrlCreateButton("ILLOGIC", 48, 568, 145, 33) Global $descramble = GUICtrlCreateButton("LOGIC", 240, 568, 145, 33) Global $exiteer = GUICtrlCreateButton("EXIT", 808, 568, 145, 33) Global $entry = GUICtrlCreateEdit("", 40, 128, 921, 417) GUICtrlSetData(-1, "Empty File...") GUICtrlSetBkColor(-1, 0xE3E3E3) Global $Pic1 = GUICtrlCreatePic("C:\AutoIt3\illogic\illogic.jpg", 40, 16, 921, 89) Global $reset = GUICtrlCreateButton("RESET", 432, 568, 147, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $seeyou, $close, $aboutbox, $version, $add0, $add1, $add2, $add3, $add4, $add5, $add6, $add7, $add8, $add9 $close = "Close Aplication?" $seeyou = "Bye For Now & See You Next Time..." $aboutbox = "About ..." $version = "illogic v. 1.0 - the illogical scrambler" & @CRLF & @CRLF & "(c) 2019 roeselpi" & @CRLF & @CRLF & "with a lot of help! thanks!" $add0 = "0" $add1 = "1" $add2 = "2" $add3 = "3" $add4 = "4" $add5 = "5" $add6 = "6" $add7 = "7" $add8 = "8" $add9 = "9" While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Global $exitbutton $exitbutton = MsgBox(36, $close, $seeyou) If $exitbutton = 6 Then Exit Case $Exit Global $exitbutton $exitbutton = MsgBox(36, $close, $seeyou) If $exitbutton = 6 Then Exit Case $exiteer Global $exitbutton $exitbutton = MsgBox(36, $close, $seeyou) If $exitbutton = 6 Then Exit Case $About MsgBox(0,$aboutbox,$version) Case $SaveAs $EntryData = GUICtrlRead($entry) $SaveLocation = FileSaveDialog("Save file", @ScriptDir, "All Files (*.*)", 16) FileWrite($SaveLocation, $EntryData) Case $NewFile GUICtrlSetData($entry, "New File...") Case $reset GUICtrlSetData($entry, "Reset...") Case $OpenFile $read = FileOpenDialog("Open File", @ScriptDir, "All Files (*.*)", 16) $text = FileRead($read, -1) GUICtrlSetData($entry, $text) FileClose($text) Case $scramble $plaintext = GUICtrlRead($entry) ;ConsoleWrite($plaintext) $Str = $plaintext $Arr = StringSplit ( $str , "" ) _ArrayDisplay ($Arr) $Arr[0] = "" Global $UsedMethode = 1 Local $Methode1Array = [$add0, $add1, $add2, $add3, $add4, $add5, $add6, $add7, $add8, $add9] $SecondIndex = UBound ($Methode1Array) $NewString = "" Global $b=$SecondIndex $usedMethode = 1 $NewString = "" ; We reset result anyway before new generation If $UsedMethode = 1 Then $Raws = UBound ($Arr) ;"ABC" = 3 Lines For $i = 1 to $Raws Step 1 ;$Arr = 3 $b -= 1 If $b = 0 Then $b = $SecondIndex ; This is how we manage random amount of characteres with your algorythm $NewString = $NewString & $Arr[$i-1] & $Methode1Array[$b-1] Next EndIf GUICtrlSetData($entry, $NewString) Case $descramble $scrambletext = GUICtrlRead($entry) ;ConsoleWrite($scrambletext) $Str = $scrambletext $Arr = StringSplit ( $str , "" ) _ArrayDisplay ($Arr) ;~ $Arr[0] = "" ;~ Global $UsedMethode = 1 ;~ Local $Methode1Array = [$add0, $add1, $add2, $add3, $add4, $add5, $add6, $add7, $add8, $add9] ;~ $SecondIndex = UBound ($Methode1Array) ;~ $NewString = "" ;~ Global $b=$SecondIndex ;~ $usedMethode = 1 ;~ $NewString = "" ; We reset result anyway before new generation ;~ If $UsedMethode = 1 Then ;~ $Raws = UBound ($Arr) ;"ABC" = 3 Lines ;~ For $i = 1 to $Raws Step 1 ;$Arr = 3 ;~ $b -= 1 ;~ If $b = 0 Then $b = $SecondIndex ; This is how we manage random amount of characteres with your algorythm ;~ $NewString = $NewString & $Arr[$i-1] & $Methode1Array[$b-1] ;~ Next ;~ EndIf ;~ GUICtrlSetData($entry, $NewString) EndSwitch WEnd if you try this code with the "new file..." from the menu, then you will get a fault after scrambling the plain text: Quote 8E7m6p5t4y3 2F1i0l9e8.7.6.5 see after the word Empty there is a space bar which now has been duplicated in the codestring. now i must find a way to get rid of the space somehow. and there is another issue: the scramble works but the unscramble boggles me a bit. i tried changing routines like the step to -1 and even 0 but both do not work backwards to get the plain text back to what it was. i have to go now (work) but i will be back and test your new code and see what exactly has been change and re-adapt that to my code. so, i just wanted to show you, that i am working on it and solving little issues here and there. the comments were quite helpful and somehow helped me to understand a few things, but not all. oh yes, i noticed that if you always use "new file..." then it will always generate the same code. meaning it will always start with 8 and then down to zero and then 9 and down to 5 every time. so i still have to figure out how to get the random into it. thanks for the help. i am a lot further now then i was a week ago. *hooray* will test new additions shortly and post my tests here soon. kind regards
caramen Posted March 13, 2019 Posted March 13, 2019 (edited) I worked on how to scramble but i did not even think about the reverse operation. I will take a look into it. On 3/6/2019 at 1:09 PM, roeselpi said: i am an absolute beginner and have zero experience with programming and / or scripting. i have been looking at autoit for about one week and thus do not know and / or understand a lot about it. You should take somtime to work on all your idea with AutoIT or even an othr language becose as a beginner you did a realy cool script enouth... When i was beginner i was far from that 😛 Edited March 13, 2019 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
roeselpi Posted March 14, 2019 Author Posted March 14, 2019 hello, wow, the possibility of a methode changer is great, that means i could later put 3 ini files in the same directory and the user could choose which ini file (methode) would do the srcamble for the programe. i think i will implement that as well. will be working on that for a while. that is a very very cool feature and has endless possibilities. i like that a lot. i will try it out to see if i can get this to work the way i want in the gui. it will take a few days but i will post the code once i have got it to work. this really rocks! it is even better than i had hoped for. i wish i could code like that and most of all understand what i am doing, but at the moment it still is a bit difficult, but i am getting there bit by bit. i will return with an updated version. kind regards
caramen Posted March 14, 2019 Posted March 14, 2019 (edited) Dont hesitate to use our help for your understanding. About me, I particulary like helping guys like you. You try by yourself and try to undertsand without going too fast. This is the perfect student for me . So we are here for questions if you have some. And be sure of one thing i am one of the worst helper here . Edited March 14, 2019 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
roeselpi Posted March 15, 2019 Author Posted March 15, 2019 hello, right, last night i managed to get the code switchable with your latest upgrade (the multiple methode system). however i am a bit at a loss with the functions parameters, so i decided to get rid of those. i can not really understand how functions work. but never mind. it works now with a pretty drop-down-box and i am quite happy. the next big thing would be the reverse action (the logic button) but take a look for yourself what it looks like now: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <WinAPIFiles.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <Array.au3> #include <ComboConstants.au3> ; $ini = "illogic.ini" ; $sections = IniReadSectionNames($ini) ; For $a = 1 To UBound($sections) - 1 ; $keys = IniReadSection($ini, $sections[$a]) ; For $b = 1 To UBound($keys) - 1 ; ConsoleWrite($keys[$b][1] & @CRLF) ; ; ShellExecute(IniRead($ini, $sections[$a], $keys[$b][0], "")) ; Next ; Next #Region ### START Koda GUI section ### Form=C:\AutoIt3\illogic\illogic-mask.kxf Global $Navigation = GUICreate("illogic - the illogical scrambler", 1002, 653, -1, -1) Global $File = GUICtrlCreateMenu("&File") Global $NewFile = GUICtrlCreateMenuItem("New File", $File) Global $OpenFile = GUICtrlCreateMenuItem("Open File", $File) Global $SaveAs = GUICtrlCreateMenuItem("Save as...", $File) Global $Exit = GUICtrlCreateMenuItem("Exit", $File) Global $etc = GUICtrlCreateMenu("?") Global $About = GUICtrlCreateMenuItem("About", $etc) Global $scramble = GUICtrlCreateButton("ILLOGIC", 48, 568, 145, 33) Global $descramble = GUICtrlCreateButton("LOGIC", 240, 568, 145, 33) Global $exiteer = GUICtrlCreateButton("EXIT", 808, 568, 145, 33) Global $entry = GUICtrlCreateEdit("", 40, 128, 921, 417) GUICtrlSetData(-1, "Empty File...") GUICtrlSetBkColor(-1, 0xE3E3E3) ;~ old image without dropdown combo box: ;~ Global $Pic1 = GUICtrlCreatePic("C:\AutoIt3\illogic\illogic.jpg", 40, 16, 921, 89) ;~ new image with dropdown combo box: Global $Pic1 = GUICtrlCreatePic("C:\AutoIt3\SciTE\heartbeat.jpg", 40, 16, 577, 89) Global $reset = GUICtrlCreateButton("RESET", 432, 568, 147, 33) Global $selector = GUICtrlCreateCombo("select the encryption method...", 664, 48, 281, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Methode 1|Methode 2|Methode 3") GUICtrlSetBkColor(-1, 0xE3E3E3) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $seeyou, $close, $aboutbox, $version, $UsedMethode $close = "Close Aplication?" $seeyou = "Bye For Now & See You Next Time..." $aboutbox = "About ..." $version = "illogic v. 1.0 - the illogical scrambler" & @CRLF & @CRLF & "(c) 2019 roeselpi" & @CRLF & @CRLF & "with a lot of help! thanks!" Global $Methode0Array = ["@@1@@", "@@2@@", "@@3@@", "@@4@@", "@@5@@", "@@6@@", "@@7@@", "@@8@@", "@@9@@"] Global $Methode1Array = ["--1--", "--2--", "--3--", "--4--", "--5--", "--6--", "--7--", "--8--", "--9--"] Global $Methode2Array = ["##1##", "##2##", "##3##", "##4##", "##5##", "##6##", "##7##", "##8##", "##9##"] Global $Methode3Array = [""] While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Global $exitbutton $exitbutton = MsgBox(36, $close, $seeyou) If $exitbutton = 6 Then Exit Case $selector If GUICtrlRead($selector) = "Methode 1" Then $UsedMethode = 0 If GUICtrlRead($selector) = "Methode 2" Then $UsedMethode = 1 If GUICtrlRead($selector) = "Methode 3" Then $UsedMethode = 2 If GUICtrlRead($selector) = "select the encryption method..." Then $UsedMethode = 3 ;ConsoleWrite($UsedMethode) Case $Exit Global $exitbutton $exitbutton = MsgBox(36, $close, $seeyou) If $exitbutton = 6 Then Exit Case $exiteer Global $exitbutton $exitbutton = MsgBox(36, $close, $seeyou) If $exitbutton = 6 Then Exit Case $About MsgBox(0, $aboutbox, $version) Case $SaveAs $EntryData = GUICtrlRead($entry) $SaveLocation = FileSaveDialog("Save file", @ScriptDir, "All Files (*.*)", 16) FileWrite($SaveLocation, $EntryData) Case $NewFile GUICtrlSetData($entry, "New File...") Case $reset GUICtrlSetData($entry, "Reset...") Case $OpenFile $read = FileOpenDialog("Open File", @ScriptDir, "All Files (*.*)", 16) $text = FileRead($read, -1) GUICtrlSetData($entry, $text) FileClose($text) Case $scramble $plaintext = GUICtrlRead($entry) ;ConsoleWrite($plaintext) $Str = $plaintext ; ==== Methode 1: $FirstIndex = UBound($Methode0Array) Global $NewString = "" Global $a = $FirstIndex ; ==== Methode 2: $SecondIndex = UBound($Methode1Array) Global $NewString = "" Global $b = $SecondIndex ; ==== Methode 3: $ThirdIndex = UBound($Methode2Array) Global $NewString = "" Global $c = $ThirdIndex ; ==== Methode 4: $ForthIndex = UBound($Methode3Array) Global $NewString = "" Global $d = $ForthIndex $Arr = StringSplit($Str, "") ;_ArrayDisplay($Arr) $Arr[0] = "" If $UsedMethode = 1 Then $Raws = UBound($Arr) For $i = 1 To $Raws Step 1 $b -= 1 If $b = 0 Then $b = $SecondIndex $NewString = $NewString & $Arr[$i - 1] & $Methode1Array[$b - 1] Next ElseIf $UsedMethode = 0 Then $Raws = UBound($Arr) For $i = 1 To $Raws Step 1 $a -= 1 If $a = 0 Then $a = $FirstIndex $NewString = $NewString & $Arr[$i - 1] & $Methode0Array[$a - 1] Next ElseIf $UsedMethode = 2 Then $Raws = UBound($Arr) For $i = 1 To $Raws Step 1 $c -= 1 If $c = 0 Then $c = $ThirdIndex $NewString = $NewString & $Arr[$i - 1] & $Methode2Array[$c - 1] Next ElseIf $UsedMethode = 3 Then $Raws = UBound($Arr) For $i = 1 To $Raws Step 1 $d -= 1 If $d = 0 Then $d = $ForthIndex $NewString = $NewString & $Arr[$i - 1] & $Methode3Array[$d - 1] Next EndIf $UsedMethode = 0 GUICtrlSetData($entry, $NewString) $UsedMethode = 1 GUICtrlSetData($entry, $NewString) $UsedMethode = 2 GUICtrlSetData($entry, $NewString) $UsedMethode = 3 GUICtrlSetData($entry, $NewString) Case $descramble $scrambletext = GUICtrlRead($entry) ;ConsoleWrite($scrambletext) $Str = $scrambletext $Arr = StringSplit($Str, "") _ArrayDisplay($Arr) EndSwitch WEnd i will not be able to post/read or do anything now before (earliest) sunday or monday. but check it out so far :-) kind regards
caramen Posted March 15, 2019 Posted March 15, 2019 I guess the descramble function is going on a complex regex and this is good for me i am trying to improve my regex skill. I have no time for that actually but i will see that later. My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
roeselpi Posted March 18, 2019 Author Posted March 18, 2019 hi, i am back amongst the living again. currently i am trying to tweak my code a little to make it a bit more universal, because i ran into the issue that changing one thing that is there several times kept resulting in errors when only one thing is changed. namely editing the dropdownbox description must be in several places and if they all are not the same, then errors will occur with my script. being angry with myself about that i am now trying to turn off problem after problem, but in general my post above still resembles the exact same functions. i must say that i think the switch for different encryption methods is so great. at first i thought, i will never really need that, but it is a fantastic addition and i am so happy about that. acutally i thought that unscrambling would be just as easy. i am no programmer but my understanding is that: if you stick to the universal rule that every method for itself must always consist of say 5 digits, then the reverse action would just have to count 5 digits and delete them but leave every 6th digit same would go for each method ... for example: method 1 = always 3 digits == 123 method 2 = always 4 digits == 1234 method 3 = always 5 digits == 12345 so if the string is split it should be fairly simple to let a 'step' count the digits and then delete them and leave the next digit in the text. the only bad thing about that would of course be if the number of digits is altered in the method by accident. then the whole system would not work easy and simple. writing a complex check to see if the exact phrase from one of the methods is probably not possible and here is just one example why: method = ["ine", "air", "iri", "ris", ...] fair is fine = the text to encrypt the encrypted text would be for example: fineaairiirirris... the "ine" or the "air" would already be in the original document and would be deleted anyway because it resembles the parameters that were given. i think the counting option would be the easiest to do without going to much into depth. as i say i am no programmer but from my common sense it would seeme to be the easiest solution just reducing it to simple counting. just like the encryption is always adding a number of things between each letter. there will probably be a solution what makes it flawless for counting and for checking but i think concentrating on just one (the simpler one) of the options would make the task maybe a bit easier? i do not know but that is at least the feeling i get from looking at the encryption that you have developed. my thoughts any help? kind regards
caramen Posted March 19, 2019 Posted March 19, 2019 Hmmm I am myself improving me on this kind of things. But i can give you my best hint for that : https://regex101.com/ On this web site you can elabor a correct syntax to use with the function StringRegExp in the help file. My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki
roeselpi Posted March 23, 2019 Author Posted March 23, 2019 hi, after a lot of reading, testing and trying, i can say that i was successful. i must say, that i did read a lot of old threads here on the forum and found the answer to the descramble in this thread: multiple string replacement discussion so i got to work testing the first possible solution being a long and not so good solution: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <WinAPIFiles.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <Array.au3> #include <String.au3> #include <ComboConstants.au3> Global $scrambled = "@@8@@N@@7@@e@@6@@w@@5@@_@@4@@F@@3@@i@@2@@l@@1@@e@@9@@.@@8@@.@@7@@.@@6@@" Global $key1 = "@@1@@" Global $key2 = "@@2@@" Global $key3 = "@@3@@" Global $key4 = "@@4@@" Global $key5 = "@@5@@" Global $key6 = "@@6@@" Global $key7 = "@@7@@" Global $key8 = "@@8@@" Global $key9 = "@@9@@" Global $key0 = "_" $scrambled1 = StringReplace($scrambled, $key1, "") $scrambled2 = StringReplace($scrambled1, $key2, "") $scrambled3 = StringReplace($scrambled2, $key3, "") $scrambled4 = StringReplace($scrambled3, $key4, "") $scrambled5 = StringReplace($scrambled4, $key5, "") $scrambled6 = StringReplace($scrambled5, $key6, "") $scrambled7 = StringReplace($scrambled6, $key7, "") $scrambled8 = StringReplace($scrambled7, $key8, "") $scrambled9 = StringReplace($scrambled8, $key9, "") $scrambled10 = StringReplace($scrambled9, $key0, " ") ConsoleWrite($scrambled10 & @CRLF) MsgBox (0,0,$scrambled10) after that i kept on reading and was happy to find a shorter way: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <WinAPIFiles.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <Array.au3> #include <String.au3> #include <ComboConstants.au3> Global $scrambled = "@@8@@N@@7@@e@@6@@w@@5@@_@@4@@F@@3@@i@@2@@l@@1@@e@@9@@.@@8@@.@@7@@.@@6@@" Local $a_rep[10][2] = [["@@1@@", ""], ["@@2@@", ""], ["@@3@@", ""], ["@@4@@", ""], ["@@5@@", ""], ["@@6@@", ""], ["@@7@@", ""], ["@@8@@", ""], ["@@9@@", ""], ["_", " "]] For $i = 0 To Ubound($a_rep, 1) - 1 $scrambled = StringRegExpReplace($scrambled, "\Q" & $a_rep[$i][0] & "\E", $a_rep[$i][1]) Next ConsoleWrite($scrambled & @CRLF) MsgBox (0,0,$scrambled) so after that, it was just adapting that code to fit into my script and i am happy to say that i now have at least a working scramble and unscramble switch with three different modes to chose from: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <WinAPIFiles.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <Array.au3> #include <String.au3> #include <ComboConstants.au3> ; $ini = "illogic.ini" ; $sections = IniReadSectionNames($ini) ; For $a = 1 To UBound($sections) - 1 ; $keys = IniReadSection($ini, $sections[$a]) ; For $b = 1 To UBound($keys) - 1 ; ConsoleWrite($keys[$b][1] & @CRLF) ; ; ShellExecute(IniRead($ini, $sections[$a], $keys[$b][0], "")) ; Next ; Next #Region ### START Koda GUI section ### Form=C:\AutoIt3\illogic\illogic-mask.kxf Global $Navigation = GUICreate("illogic - the illogical scrambler", 1002, 653, -1, -1) Global $File = GUICtrlCreateMenu("&File") Global $NewFile = GUICtrlCreateMenuItem("New File", $File) Global $OpenFile = GUICtrlCreateMenuItem("Open File", $File) Global $SaveAs = GUICtrlCreateMenuItem("Save as...", $File) Global $Exit = GUICtrlCreateMenuItem("Exit", $File) Global $etc = GUICtrlCreateMenu("?") Global $About = GUICtrlCreateMenuItem("About", $etc) Global $scramble = GUICtrlCreateButton("ILLOGIC", 48, 568, 145, 33) Global $descramble = GUICtrlCreateButton("LOGIC", 240, 568, 145, 33) Global $exiteer = GUICtrlCreateButton("EXIT", 808, 568, 145, 33) Global $entry = GUICtrlCreateEdit("", 40, 128, 921, 417, $ES_AUTOVSCROLL, $WS_EX_CLIENTEDGE) GUICtrlSetData(-1, "Empty File...") GUICtrlSetBkColor(-1, 0xE3E3E3) ;~ old image without dropdown combo box: ;~ Global $Pic1 = GUICtrlCreatePic("C:\AutoIt3\illogic\illogic.jpg", 40, 16, 921, 89) ;~ new image with dropdown combo box: Global $Pic1 = GUICtrlCreatePic("C:\AutoIt3\SciTE\heartbeat.jpg", 40, 16, 577, 89) Global $reset = GUICtrlCreateButton("RESET", 432, 568, 147, 33) Global $ddstart, $ddlinebr, $ddmode1, $ddmode2, $ddmode3 $ddstart = "please select the encryption mode below..." $ddlinebr = "|" $ddmode1 = "encryption mode 1" $ddmode2 = "encryption mode 2" $ddmode3 = "encryption mode 3" Global $selector = GUICtrlCreateCombo($ddstart, 664, 48, 281, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $ddmode1 & $ddlinebr & $ddmode2 & $ddlinebr & $ddmode3) GUICtrlSetBkColor(-1, 0xE3E3E3) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $seeyou, $close, $aboutbox, $version $close = "Close Aplication?" $seeyou = "Bye For Now & See You Next Time..." $aboutbox = "About ..." $version = "illogic v. 1.0 - the illogical scrambler" & @CRLF & @CRLF & "(c) 2019 roeselpi" & @CRLF & @CRLF & "with a lot of help! thanks!" Global $Mode0Array = [""] ; Mode 0 Global $Mode1Array = ["@@1@@", "@@2@@", "@@3@@", "@@4@@", "@@5@@", "@@6@@", "@@7@@", "@@8@@", "@@9@@"] ; Mode 1 Global $Mode2Array = ["--1--", "--2--", "--3--", "--4--", "--5--", "--6--", "--7--", "--8--", "--9--"] ; Mode 2 Global $Mode3Array = ["##1##", "##2##", "##3##", "##4##", "##5##", "##6##", "##7##", "##8##", "##9##"] ; Mode 3 Global $replace0Array[10][2] = [["", ""], ["", ""], ["", ""], ["", ""], ["", ""], ["", ""], ["", ""], ["", ""], ["", ""], ["", ""]] ; Mode 0 Global $replace1Array[10][2] = [["@@1@@", ""], ["@@2@@", ""], ["@@3@@", ""], ["@@4@@", ""], ["@@5@@", ""], ["@@6@@", ""], ["@@7@@", ""], ["@@8@@", ""], ["@@9@@", ""], ["_", " "]] ; Mode 1 Global $replace2Array[10][2] = [["--1--", ""], ["--2--", ""], ["--3--", ""], ["--4--", ""], ["--5--", ""], ["--6--", ""], ["--7--", ""], ["--8--", ""], ["--9--", ""], ["_", " "]] ; Mode 2 Global $replace3Array[10][2] = [["##1##", ""], ["##2##", ""], ["##3##", ""], ["##4##", ""], ["##5##", ""], ["##6##", ""], ["##7##", ""], ["##8##", ""], ["##9##", ""], ["_", " "]] ; Mode 3 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Global $exitbutton $exitbutton = MsgBox(36, $close, $seeyou) If $exitbutton = 6 Then Exit Case $selector If GUICtrlRead($selector) = $ddstart Then $UsedMode = 0 If GUICtrlRead($selector) = $ddmode1 Then $UsedMode = 1 If GUICtrlRead($selector) = $ddmode2 Then $UsedMode = 2 If GUICtrlRead($selector) = $ddmode3 Then $UsedMode = 3 ;ConsoleWrite($UsedMethode) Case $Exit Global $exitbutton $exitbutton = MsgBox(36, $close, $seeyou) If $exitbutton = 6 Then Exit Case $exiteer Global $exitbutton $exitbutton = MsgBox(36, $close, $seeyou) If $exitbutton = 6 Then Exit Case $About MsgBox(0, $aboutbox, $version) Case $SaveAs $EntryData = GUICtrlRead($entry) $SaveLocation = FileSaveDialog("Save file", @ScriptDir, "All Files (*.*)", 16) FileWrite($SaveLocation, $EntryData) Case $NewFile GUICtrlSetData($entry, "New File...") Case $reset GUICtrlSetData($entry, "Reset...") Case $OpenFile $read = FileOpenDialog("Open File", @ScriptDir, "All Files (*.*)", 16) $text = FileRead($read, -1) GUICtrlSetData($entry, $text) FileClose($text) Case $scramble $plaintext = GUICtrlRead($entry) ;ConsoleWrite($plaintext) $fillgaps = StringReplace($plaintext, " ", "_") ;ConsoleWrite($fillgaps) GUICtrlSetData($entry, $fillgaps) $plaintext = GUICtrlRead($entry) ;ConsoleWrite($plaintext) $Str = $plaintext ; ==== Mode 0: $FirstIndex = UBound($Mode0Array) Global $NewString = "" Global $a = $FirstIndex ; ==== Mode 1: $SecondIndex = UBound($Mode1Array) Global $NewString = "" Global $b = $SecondIndex ; ==== Mode 2: $ThirdIndex = UBound($Mode2Array) Global $NewString = "" Global $c = $ThirdIndex ; ==== Mode 3: $ForthIndex = UBound($Mode3Array) Global $NewString = "" Global $d = $ForthIndex $Arr = StringSplit($Str, "") ;_ArrayDisplay($Arr) $Arr[0] = "" If $UsedMode = 0 Then $Raws = UBound($Arr) For $i = 1 To $Raws Step 1 $a -= 1 If $a = 0 Then $a = $FirstIndex $NewString = $NewString & $Arr[$i - 1] & $Mode0Array[$a - 1] Next ElseIf $UsedMode = 1 Then $Raws = UBound($Arr) For $i = 1 To $Raws Step 1 $b -= 1 If $b = 0 Then $b = $SecondIndex $NewString = $NewString & $Arr[$i - 1] & $Mode1Array[$b - 1] Next ElseIf $UsedMode = 2 Then $Raws = UBound($Arr) For $i = 1 To $Raws Step 1 $c -= 1 If $c = 0 Then $c = $ThirdIndex $NewString = $NewString & $Arr[$i - 1] & $Mode2Array[$c - 1] Next ElseIf $UsedMode = 3 Then $Raws = UBound($Arr) For $i = 1 To $Raws Step 1 $d -= 1 If $d = 0 Then $d = $ForthIndex $NewString = $NewString & $Arr[$i - 1] & $Mode3Array[$d - 1] Next EndIf If $UsedMode = 0 Then GUICtrlSetData($entry, $NewString) If $UsedMode = 1 Then GUICtrlSetData($entry, $NewString) If $UsedMode = 2 Then GUICtrlSetData($entry, $NewString) If $UsedMode = 3 Then GUICtrlSetData($entry, $NewString) Case $descramble $scrambletext = GUICtrlRead($entry) ;ConsoleWrite($scrambletext) ;$Str = $scrambletext ;$Arr = StringSplit($Str, "") ;_ArrayDisplay($Arr) If $UsedMode = 0 Then $descramble0 = $scrambletext For $i = 0 To Ubound($replace0Array, 1) - 1 $descramble0 = StringRegExpReplace($descramble0, "\Q" & $replace0Array[$i][0] & "\E", $replace0Array[$i][1]) Next ElseIf $UsedMode = 1 Then $descramble1 = $scrambletext For $i = 0 To Ubound($replace1Array, 1) - 1 $descramble1 = StringRegExpReplace($descramble1, "\Q" & $replace1Array[$i][0] & "\E", $replace1Array[$i][1]) Next ElseIf $UsedMode = 2 Then $descramble2 = $scrambletext For $i = 0 To Ubound($replace2Array, 1) - 1 $descramble2 = StringRegExpReplace($descramble2, "\Q" & $replace2Array[$i][0] & "\E", $replace2Array[$i][1]) Next ElseIf $UsedMode = 3 Then $descramble3 = $scrambletext For $i = 0 To Ubound($replace3Array, 1) - 1 $descramble3 = StringRegExpReplace($descramble3, "\Q" & $replace3Array[$i][0] & "\E", $replace3Array[$i][1]) Next EndIf If $UsedMode = 0 Then GUICtrlSetData($entry, $descramble0) If $UsedMode = 1 Then GUICtrlSetData($entry, $descramble1) If $UsedMode = 2 Then GUICtrlSetData($entry, $descramble2) If $UsedMode = 3 Then GUICtrlSetData($entry, $descramble3) EndSwitch WEnd i am quite happy with the solution, but there are still some issues that need to be solved: 1. if you run my script, and just press "ILLOGIC" without having chosen a method/mode first, then the script crashes with the following information: Quote "C:\AutoIt3\illogic\illogic.au3" (156) : ==> Variable used without being declared.: If $UsedMode = 0 Then If ^ ERROR ->14:12:08 AutoIt3.exe ended.rc:1 there must be a way to stop that from happening, but the question is: how? or what must be done to stop that? 2. now that the script works it is time to make it more universal. that means that changeable information (settings) must be outsourced to a ini-file so that only the ini-file must be changed to receive different results. and as far a i can see the informaton that needs to be outsourced is the mode/method data: Global $Mode0Array = [""] ; Mode 0 Global $Mode1Array = ["@@1@@", "@@2@@", "@@3@@", "@@4@@", "@@5@@", "@@6@@", "@@7@@", "@@8@@", "@@9@@"] ; Mode 1 Global $Mode2Array = ["--1--", "--2--", "--3--", "--4--", "--5--", "--6--", "--7--", "--8--", "--9--"] ; Mode 2 Global $Mode3Array = ["##1##", "##2##", "##3##", "##4##", "##5##", "##6##", "##7##", "##8##", "##9##"] ; Mode 3 Global $replace0Array[10][2] = [["", ""], ["", ""], ["", ""], ["", ""], ["", ""], ["", ""], ["", ""], ["", ""], ["", ""], ["", ""]] ; Mode 0 Global $replace1Array[10][2] = [["@@1@@", ""], ["@@2@@", ""], ["@@3@@", ""], ["@@4@@", ""], ["@@5@@", ""], ["@@6@@", ""], ["@@7@@", ""], ["@@8@@", ""], ["@@9@@", ""], ["_", " "]] ; Mode 1 Global $replace2Array[10][2] = [["--1--", ""], ["--2--", ""], ["--3--", ""], ["--4--", ""], ["--5--", ""], ["--6--", ""], ["--7--", ""], ["--8--", ""], ["--9--", ""], ["_", " "]] ; Mode 2 Global $replace3Array[10][2] = [["##1##", ""], ["##2##", ""], ["##3##", ""], ["##4##", ""], ["##5##", ""], ["##6##", ""], ["##7##", ""], ["##8##", ""], ["##9##", ""], ["_", " "]] ; Mode 3 my main questions would be now concerning that ini-file: would it have to be something like this: [Mode0Array] alter=["@@1@@", "@@2@@", "@@3@@", "@@4@@", "@@5@@", "@@6@@", "@@7@@", "@@8@@", "@@9@@"] or would it have to be individual parts for each Mode Array like this: [Mode0Array] setting1=@@1@@ setting2=@@2@@ ... etc ... any ideas here for that? 3. last and final step would be adding a randomizer that will take the data from each mode from the encryption and randomize the order it is used in. but in general i am quite happy already the way it is. @caramen: if you have any better ideas then please let me know. i am willing to learn and understand more. a lot of things do not make sense to me yet, but i am trying as best i can with the little time i have. any thoughts on my reamaining 3 problems? and any thoughs on the descramble solution? kind regards
roeselpi Posted March 23, 2019 Author Posted March 23, 2019 hi, just started testing my code a little and found some issues that are a bit odd. i made a testfile with the following text inside (just a standard text file) Quote This is a testing File for the illogcial scrambler: First Test: The numbers. Like on any keyboard... one to zero: 1234567890 should be: one,two,three,four,five,six,seven,eight,nine,zero Second Test: The special Chars. Like on any keyboard again: numeral row: !"²§³$%&/{([)]=}ß?\´` should be: exclmation-point, quote-sign, higher-two, paragraph-sign, higher-three, dollar-symbol, percent-sign, and-sign, slash-sign, wavy-brackets-open-sign, normal-brackets-open-sign, box-brackets-open-sign, normal-brackets-close-sign, box-bracktes-close-sign, equals-sign, wavy-brackets-close-sign, german-sharp-s-sign, question-mark, backslash-sign accent-upwards-left-to-right, accent-downwards-left-to-right qwertz row: @€ü+*#' should be: at-symbol, euro-symbol, u-with-two-dots-on-top, plus-sign, star-sign, hashtag-sign, apostroph-sign asdf row: öä should be: o-with-two-dots-on-top, a-with-two-dots-on-top yxcv row: ,;.:-_ should be: comma, comma-with-a-dot-above, fullstop, fullstop-with-a-dot-above, minus-symbol, underscore-symbol spacebar row: ^°<>| should be: arrowhead-pointing-up, degrees-sign, arrowhead-pointing-left, arrowhead-pointing-right, long-straight-line-down now lets look at the result. then i ran the encryption mode one two and three and the result when descrambling is not right every time. the mistakes on all three modes are the same ones. it has something to do with the numbers i think: result after encryption with mode one and then decrypting the text afterwards: mistakes are the numbers 1 to 0 and the underscore-sign. i will just post the generated unscrable-code where the errors are from all three modes: @@543@@345@@987@@890 --543--345--987--890 ##543##345##987##890 should be: one,two,three,four,five,six,seven,eight,nine,zero now the missing underscore-sign is not so bad, because i made a stringreplace on that anyway, but the numbers are somehow not done right and in every mode the result is exactly the same error. that is why i copied all three results from the modes so it is easy to see that there is an error with numerals. i also took the time to test something else. i changed the strings from method1 to see what the result would look like then: Global $Mode1Array = ["abcde", "fghij", "klmno", "pqrst", "uvwxy", "z1234", "56789", "0abcd", "efghi"] ; Mode 1 Global $replace1Array[10][2] = [["abcde", ""], ["fghij", ""], ["klmno", ""], ["pqrst", ""], ["uvwxy", ""], ["z1234", ""], ["56789", ""], ["0abcd", ""], ["efghi", ""], ["_", " "]] ; Mode 1 if you change these two lines for the existing ones, then there are still errors in the unscrambling. the error are only minor, but there are some. however the numerals work perfectly with thie alternative settings. in other words: there is a bug in the unscramble-function. that is kind of what i expected to happen. my original idea was basing the unscramble on a counting. more or less delete everything but leave every sixth letter where it was. that might limit the function to an exact amount of scramble-parameters but it should work. maybe somebody who is also reading and following this topic can see where errors are and can explain why there are these errors and how to get rid of the errors. kind regards
roeselpi Posted March 28, 2019 Author Posted March 28, 2019 hello, i would like to update a few things now: i have been altering my program now and refining it to suit my needs: Changes: 1. outsourced the settings to 4 different ini files and each ini file has four different modes as a choice. that means there are 16 encryption possibilities. 2. i have exchanged the combobox through radio-buttons. (at the moment they still display a msgbox but that is only for testing) here is the rundown: every ini-file MUST look like this, the values of course can be edited but the m1k00 .... m4k09 must remain in the place they are and the way they are. expandcollapse popup[mode 1] m1k00=aa0aa m1k01=aa1aa m1k02=aa2aa m1k03=aa3aa m1k04=aa4aa m1k05=aa5aa m1k06=aa6aa m1k07=aa7aa m1k08=aa8aa m1k09=aa9aa [mode 2] m2k00=bb0bb m2k01=bb1bb m2k02=bb2bb m2k03=bb3bb m2k04=bb4bb m2k05=bb5bb m2k06=bb6bb m2k07=bb7bb m2k08=bb8bb m2k09=bb9bb [mode 3] m3k00=cc0cc m3k01=cc1cc m3k02=cc2cc m3k03=cc3cc m3k04=cc4cc m3k05=cc5cc m3k06=cc6cc m3k07=cc7cc m3k08=cc8cc m3k09=cc9cc [mode 4] m4k00=dd0dd m4k01=dd1dd m4k02=dd2dd m4k03=dd3dd m4k04=dd4dd m4k05=dd5dd m4k06=dd6dd m4k07=dd7dd m4k08=dd8dd m4k09=dd9dd here is my sourcecode for the programe at the moment: expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <FileConstants.au3> #include <WinAPIFiles.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <Array.au3> #include <String.au3> #include <ComboConstants.au3> #Region ### START Koda GUI section ### Form=C:\AutoIt3\illogic\illlogic-mask3.kxf Global $Navigation = GUICreate("illogic - the illogical scrambler", 1002, 653, -1, -1) Global $File = GUICtrlCreateMenu("&File") Global $NewFile = GUICtrlCreateMenuItem("New File", $File) Global $OpenFile = GUICtrlCreateMenuItem("Open File", $File) Global $SaveAs = GUICtrlCreateMenuItem("Save as...", $File) Global $Exit = GUICtrlCreateMenuItem("Exit", $File) Global $etc = GUICtrlCreateMenu("?") Global $About = GUICtrlCreateMenuItem("About", $etc) Global $scramble = GUICtrlCreateButton("ILLOGIC", 48, 568, 145, 33) Global $descramble = GUICtrlCreateButton("LOGIC", 240, 568, 145, 33) Global $exiteer = GUICtrlCreateButton("EXIT", 808, 568, 145, 33) Global $entry = GUICtrlCreateEdit("", 40, 128, 921, 417) GUICtrlSetData(-1, "Empty File...") GUICtrlSetBkColor(-1, 0xE3E3E3) Global $Pic1 = GUICtrlCreatePic("C:\AutoIt3\SciTE\heartbeat.jpg", 40, 16, 497, 89) Global $reset = GUICtrlCreateButton("RESET", 432, 568, 147, 33) Global $iniselect = GUICtrlCreateGroup("ini-file Selection", 560, 16, 401, 41) Global $inifile1 = GUICtrlCreateRadio("ini-file 1", 568, 32, 85, 17) Global $inifile2 = GUICtrlCreateRadio("ini-file 2", 672, 32, 85, 17) Global $inifile3 = GUICtrlCreateRadio("ini-file 3", 768, 32, 85, 17) Global $inifile4 = GUICtrlCreateRadio("ini-file 4", 864, 32, 85, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) Global $modeselect = GUICtrlCreateGroup("Mode Selection", 560, 64, 401, 41) Global $modus1 = GUICtrlCreateRadio("mode 1", 568, 80, 85, 17) Global $modus2 = GUICtrlCreateRadio("mode 2", 672, 80, 85, 17) Global $modus3 = GUICtrlCreateRadio("mode 3", 768, 80, 89, 17) Global $modus4 = GUICtrlCreateRadio("mode 4", 864, 80, 85, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $seeyou, $close, $aboutbox, $version $close = "Close Aplication?" $seeyou = "Bye For Now & See You Next Time..." $aboutbox = "About ..." $version = "illogic v. 1.2 - the illogical scrambler" & @CRLF & @CRLF & "(c) 2019 roeselpi" & @CRLF & @CRLF & "with a lot of help! thanks!" While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Global $exitbutton $exitbutton = MsgBox(36, $close, $seeyou) If $exitbutton = 6 Then Exit Case $Exit Global $exitbutton $exitbutton = MsgBox(36, $close, $seeyou) If $exitbutton = 6 Then Exit Case $exiteer Global $exitbutton $exitbutton = MsgBox(36, $close, $seeyou) If $exitbutton = 6 Then Exit Case $About MsgBox(0, $aboutbox, $version) Case $SaveAs $EntryData = GUICtrlRead($entry) $SaveLocation = FileSaveDialog("Save file", @ScriptDir, "All Files (*.*)", 16) FileWrite($SaveLocation, $EntryData) Case $NewFile GUICtrlSetData($entry, "New File...") Case $reset GUICtrlSetData($entry, "Reset...") GUICtrlSetState($inifile1, $GUI_UNCHECKED) GUICtrlSetState($inifile2, $GUI_UNCHECKED) GUICtrlSetState($inifile3, $GUI_UNCHECKED) GUICtrlSetState($inifile4, $GUI_UNCHECKED) GUICtrlSetState($modus1, $GUI_UNCHECKED) ;----- will not work and i do not know why not GUICtrlSetState($modus2, $GUI_UNCHECKED) ;----- will not work and i do not know why not GUICtrlSetState($modus3, $GUI_UNCHECKED) ;----- will not work and i do not know why not GUICtrlSetState($modus4, $GUI_UNCHECKED) ;----- will not work and i do not know why not Case $OpenFile $read = FileOpenDialog("Open File", @ScriptDir, "All Files (*.*)", 16) $text = FileRead($read, -1) GUICtrlSetData($entry, $text) FileClose($text) Case $inifile1 $file1 = "illogic1.ini" Case $inifile2 $file2 = "illogic2.ini" Case $inifile3 $file3 = "illogic3.ini" Case $inifile4 $file4 = "illogic4.ini" Case $modus1 $modus1 = 1 If GUICtrlRead($inifile1) = 1 Then $m1k = IniReadSection($file1, "mode 1") $m1k = _ArrayExtract($m1k, 1, -1, 1, 1) $m1k00 = $m1k[0] $m1k01 = $m1k[1] $m1k02 = $m1k[2] $m1k03 = $m1k[3] $m1k04 = $m1k[4] $m1k05 = $m1k[5] $m1k06 = $m1k[6] $m1k07 = $m1k[7] $m1k08 = $m1k[8] $m1k09 = $m1k[9] Global $Mode1Array = [$m1k00, $m1k01, $m1k02, $m1k03, $m1k04, $m1k05, $m1k06, $m1k07, $m1k08, $m1k09] ; Mode 1 Global $replace1Array[11][2] = [[$m1k00, ""], [$m1k01, ""], [$m1k02, ""], [$m1k03, ""], [$m1k04, ""], [$m1k05, ""], [$m1k06, ""], [$m1k07, ""], [$m1k08, ""], [$m1k09, ""], ["_", " "]] ; Mode 1 MsgBox(0,0,$m1k03) ElseIf GUICtrlRead($inifile2) = 1 Then $m1k = IniReadSection($file2, "mode 1") $m1k = _ArrayExtract($m1k, 1, -1, 1, 1) $m1k00 = $m1k[0] $m1k01 = $m1k[1] $m1k02 = $m1k[2] $m1k03 = $m1k[3] $m1k04 = $m1k[4] $m1k05 = $m1k[5] $m1k06 = $m1k[6] $m1k07 = $m1k[7] $m1k08 = $m1k[8] $m1k09 = $m1k[9] Global $Mode1Array = [$m1k00, $m1k01, $m1k02, $m1k03, $m1k04, $m1k05, $m1k06, $m1k07, $m1k08, $m1k09] ; Mode 1 Global $replace1Array[11][2] = [[$m1k00, ""], [$m1k01, ""], [$m1k02, ""], [$m1k03, ""], [$m1k04, ""], [$m1k05, ""], [$m1k06, ""], [$m1k07, ""], [$m1k08, ""], [$m1k09, ""], ["_", " "]] ; Mode 1 MsgBox(0,0,$m1k05) ElseIf GUICtrlRead($inifile3) = 1 Then $m1k = IniReadSection($file3, "mode 1") $m1k = _ArrayExtract($m1k, 1, -1, 1, 1) $m1k00 = $m1k[0] $m1k01 = $m1k[1] $m1k02 = $m1k[2] $m1k03 = $m1k[3] $m1k04 = $m1k[4] $m1k05 = $m1k[5] $m1k06 = $m1k[6] $m1k07 = $m1k[7] $m1k08 = $m1k[8] $m1k09 = $m1k[9] MsgBox(0,0,$m1k07) Global $Mode1Array = [$m1k00, $m1k01, $m1k02, $m1k03, $m1k04, $m1k05, $m1k06, $m1k07, $m1k08, $m1k09] ; Mode 1 Global $replace1Array[11][2] = [[$m1k00, ""], [$m1k01, ""], [$m1k02, ""], [$m1k03, ""], [$m1k04, ""], [$m1k05, ""], [$m1k06, ""], [$m1k07, ""], [$m1k08, ""], [$m1k09, ""], ["_", " "]] ; Mode 1 ElseIf GUICtrlRead($inifile4) = 1 Then $m1k = IniReadSection($file4, "mode 1") $m1k = _ArrayExtract($m1k, 1, -1, 1, 1) $m1k00 = $m1k[0] $m1k01 = $m1k[1] $m1k02 = $m1k[2] $m1k03 = $m1k[3] $m1k04 = $m1k[4] $m1k05 = $m1k[5] $m1k06 = $m1k[6] $m1k07 = $m1k[7] $m1k08 = $m1k[8] $m1k09 = $m1k[9] MsgBox(0,0,$m1k09) Global $Mode1Array = [$m1k00, $m1k01, $m1k02, $m1k03, $m1k04, $m1k05, $m1k06, $m1k07, $m1k08, $m1k09] ; Mode 1 Global $replace1Array[11][2] = [[$m1k00, ""], [$m1k01, ""], [$m1k02, ""], [$m1k03, ""], [$m1k04, ""], [$m1k05, ""], [$m1k06, ""], [$m1k07, ""], [$m1k08, ""], [$m1k09, ""], ["_", " "]] ; Mode 1 EndIf Case $modus2 $modus2 = 2 If GUICtrlRead($inifile1) = 1 Then $m2k = IniReadSection($file1, "mode 2") $m2k = _ArrayExtract($m2k, 1, -1, 1, 1) $m2k00 = $m2k[0] $m2k01 = $m2k[1] $m2k02 = $m2k[2] $m2k03 = $m2k[3] $m2k04 = $m2k[4] $m2k05 = $m2k[5] $m2k06 = $m2k[6] $m2k07 = $m2k[7] $m2k08 = $m2k[8] $m2k09 = $m2k[9] Global $Mode2Array = [$m2k00, $m2k01, $m2k02, $m2k03, $m2k04, $m2k05, $m2k06, $m2k07, $m2k08, $m2k09] ; Mode 2 Global $replace2Array[11][2] = [[$m2k00, ""], [$m2k01, ""], [$m2k02, ""], [$m2k03, ""], [$m2k04, ""], [$m2k05, ""], [$m2k06, ""], [$m2k07, ""], [$m2k08, ""], [$m2k09, ""], ["_", " "]] ; Mode 2 MsgBox(0,0,$m2k03) ElseIf GUICtrlRead($inifile2) = 1 Then $m2k = IniReadSection($file2, "mode 2") $m2k = _ArrayExtract($m2k, 1, -1, 1, 1) $m2k00 = $m2k[0] $m2k01 = $m2k[1] $m2k02 = $m2k[2] $m2k03 = $m2k[3] $m2k04 = $m2k[4] $m2k05 = $m2k[5] $m2k06 = $m2k[6] $m2k07 = $m2k[7] $m2k08 = $m2k[8] $m2k09 = $m2k[9] Global $Mode2Array = [$m2k00, $m2k01, $m2k02, $m2k03, $m2k04, $m2k05, $m2k06, $m2k07, $m2k08, $m2k09] ; Mode 2 Global $replace2Array[11][2] = [[$m2k00, ""], [$m2k01, ""], [$m2k02, ""], [$m2k03, ""], [$m2k04, ""], [$m2k05, ""], [$m2k06, ""], [$m2k07, ""], [$m2k08, ""], [$m2k09, ""], ["_", " "]] ; Mode 2 MsgBox(0,0,$m2k04) ElseIf GUICtrlRead($inifile3) = 1 Then $m2k = IniReadSection($file3, "mode 2") $m2k = _ArrayExtract($m2k, 1, -1, 1, 1) $m2k00 = $m2k[0] $m2k01 = $m2k[1] $m2k02 = $m2k[2] $m2k03 = $m2k[3] $m2k04 = $m2k[4] $m2k05 = $m2k[5] $m2k06 = $m2k[6] $m2k07 = $m2k[7] $m2k08 = $m2k[8] $m2k09 = $m2k[9] Global $Mode2Array = [$m2k00, $m2k01, $m2k02, $m2k03, $m2k04, $m2k05, $m2k06, $m2k07, $m2k08, $m2k09] ; Mode 2 Global $replace2Array[11][2] = [[$m2k00, ""], [$m2k01, ""], [$m2k02, ""], [$m2k03, ""], [$m2k04, ""], [$m2k05, ""], [$m2k06, ""], [$m2k07, ""], [$m2k08, ""], [$m2k09, ""], ["_", " "]] ; Mode 2 MsgBox(0,0,$m2k07) ElseIf GUICtrlRead($inifile4) = 1 Then $m2k = IniReadSection($file4, "mode 2") $m2k = _ArrayExtract($m2k, 1, -1, 1, 1) $m2k00 = $m2k[0] $m2k01 = $m2k[1] $m2k02 = $m2k[2] $m2k03 = $m2k[3] $m2k04 = $m2k[4] $m2k05 = $m2k[5] $m2k06 = $m2k[6] $m2k07 = $m2k[7] $m2k08 = $m2k[8] $m2k09 = $m2k[9] Global $Mode2Array = [$m2k00, $m2k01, $m2k02, $m2k03, $m2k04, $m2k05, $m2k06, $m2k07, $m2k08, $m2k09] ; Mode 2 Global $replace2Array[11][2] = [[$m2k00, ""], [$m2k01, ""], [$m2k02, ""], [$m2k03, ""], [$m2k04, ""], [$m2k05, ""], [$m2k06, ""], [$m2k07, ""], [$m2k08, ""], [$m2k09, ""], ["_", " "]] ; Mode 2 MsgBox(0,0,$m2k09) EndIf Case $modus3 $modus3 = 3 If GUICtrlRead($inifile1) = 1 Then $m3k = IniReadSection($file1, "mode 3") $m3k = _ArrayExtract($m3k, 1, -1, 1, 1) $m3k00 = $m3k[0] $m3k01 = $m3k[1] $m3k02 = $m3k[2] $m3k03 = $m3k[3] $m3k04 = $m3k[4] $m3k05 = $m3k[5] $m3k06 = $m3k[6] $m3k07 = $m3k[7] $m3k08 = $m3k[8] $m3k09 = $m3k[9] Global $Mode3Array = [$m3k00, $m3k01, $m3k02, $m3k03, $m3k04, $m3k05, $m3k06, $m3k07, $m3k08, $m3k09] ; Mode 3 Global $replace3Array[11][2] = [[$m3k00, ""], [$m3k01, ""], [$m3k02, ""], [$m3k03, ""], [$m3k04, ""], [$m3k05, ""], [$m3k06, ""], [$m3k07, ""], [$m3k08, ""], [$m3k09, ""], ["_", " "]] ; Mode 3 MsgBox(0,0,$m3k02) ElseIf GUICtrlRead($inifile2) = 1 Then $m3k = IniReadSection($file2, "mode 3") $m3k = _ArrayExtract($m3k, 1, -1, 1, 1) $m3k00 = $m3k[0] $m3k01 = $m3k[1] $m3k02 = $m3k[2] $m3k03 = $m3k[3] $m3k04 = $m3k[4] $m3k05 = $m3k[5] $m3k06 = $m3k[6] $m3k07 = $m3k[7] $m3k08 = $m3k[8] $m3k09 = $m3k[9] Global $Mode3Array = [$m3k00, $m3k01, $m3k02, $m3k03, $m3k04, $m3k05, $m3k06, $m3k07, $m3k08, $m3k09] ; Mode 3 Global $replace3Array[11][2] = [[$m3k00, ""], [$m3k01, ""], [$m3k02, ""], [$m3k03, ""], [$m3k04, ""], [$m3k05, ""], [$m3k06, ""], [$m3k07, ""], [$m3k08, ""], [$m3k09, ""], ["_", " "]] ; Mode 3 MsgBox(0,0,$m3k04) ElseIf GUICtrlRead($inifile3) = 1 Then $m3k = IniReadSection($file3, "mode 3") $m3k = _ArrayExtract($m3k, 1, -1, 1, 1) $m3k00 = $m3k[0] $m3k01 = $m3k[1] $m3k02 = $m3k[2] $m3k03 = $m3k[3] $m3k04 = $m3k[4] $m3k05 = $m3k[5] $m3k06 = $m3k[6] $m3k07 = $m3k[7] $m3k08 = $m3k[8] $m3k09 = $m3k[9] Global $Mode3Array = [$m3k00, $m3k01, $m3k02, $m3k03, $m3k04, $m3k05, $m3k06, $m3k07, $m3k08, $m3k09] ; Mode 3 Global $replace3Array[11][2] = [[$m3k00, ""], [$m3k01, ""], [$m3k02, ""], [$m3k03, ""], [$m3k04, ""], [$m3k05, ""], [$m3k06, ""], [$m3k07, ""], [$m3k08, ""], [$m3k09, ""], ["_", " "]] ; Mode 3 MsgBox(0,0,$m3k06) ElseIf GUICtrlRead($inifile4) = 1 Then $m3k = IniReadSection($file4, "mode 3") $m3k = _ArrayExtract($m3k, 1, -1, 1, 1) $m3k00 = $m3k[0] $m3k01 = $m3k[1] $m3k02 = $m3k[2] $m3k03 = $m3k[3] $m3k04 = $m3k[4] $m3k05 = $m3k[5] $m3k06 = $m3k[6] $m3k07 = $m3k[7] $m3k08 = $m3k[8] $m3k09 = $m3k[9] Global $Mode3Array = [$m3k00, $m3k01, $m3k02, $m3k03, $m3k04, $m3k05, $m3k06, $m3k07, $m3k08, $m3k09] ; Mode 3 Global $replace3Array[11][2] = [[$m3k00, ""], [$m3k01, ""], [$m3k02, ""], [$m3k03, ""], [$m3k04, ""], [$m3k05, ""], [$m3k06, ""], [$m3k07, ""], [$m3k08, ""], [$m3k09, ""], ["_", " "]] ; Mode 3 MsgBox(0,0,$m3k08) EndIf Case $modus4 $modus4 = 4 If GUICtrlRead($inifile1) = 1 Then $m4k = IniReadSection($file1, "mode 4") $m4k = _ArrayExtract($m4k, 1, -1, 1, 1) $m4k00 = $m4k[0] $m4k01 = $m4k[1] $m4k02 = $m4k[2] $m4k03 = $m4k[3] $m4k04 = $m4k[4] $m4k05 = $m4k[5] $m4k06 = $m4k[6] $m4k07 = $m4k[7] $m4k08 = $m4k[8] $m4k09 = $m4k[9] Global $Mode4Array = [$m4k00, $m4k01, $m4k02, $m4k03, $m4k04, $m4k05, $m4k06, $m4k07, $m4k08, $m4k09] ; Mode 4 Global $replace4Array[11][2] = [[$m4k00, ""], [$m4k01, ""], [$m4k02, ""], [$m4k03, ""], [$m4k04, ""], [$m4k05, ""], [$m4k06, ""], [$m4k07, ""], [$m4k08, ""], [$m4k09, ""], ["_", " "]] ; Mode 4 MsgBox(0,0,$m4k02) ElseIf GUICtrlRead($inifile2) = 1 Then $m4k = IniReadSection($file2, "mode 4") $m4k = _ArrayExtract($m4k, 1, -1, 1, 1) $m4k00 = $m4k[0] $m4k01 = $m4k[1] $m4k02 = $m4k[2] $m4k03 = $m4k[3] $m4k04 = $m4k[4] $m4k05 = $m4k[5] $m4k06 = $m4k[6] $m4k07 = $m4k[7] $m4k08 = $m4k[8] $m4k09 = $m4k[9] Global $Mode4Array = [$m4k00, $m4k01, $m4k02, $m4k03, $m4k04, $m4k05, $m4k06, $m4k07, $m4k08, $m4k09] ; Mode 4 Global $replace4Array[11][2] = [[$m4k00, ""], [$m4k01, ""], [$m4k02, ""], [$m4k03, ""], [$m4k04, ""], [$m4k05, ""], [$m4k06, ""], [$m4k07, ""], [$m4k08, ""], [$m4k09, ""], ["_", " "]] ; Mode 4 MsgBox(0,0,$m4k04) ElseIf GUICtrlRead($inifile3) = 1 Then $m4k = IniReadSection($file3, "mode 4") $m4k = _ArrayExtract($m4k, 1, -1, 1, 1) $m4k00 = $m4k[0] $m4k01 = $m4k[1] $m4k02 = $m4k[2] $m4k03 = $m4k[3] $m4k04 = $m4k[4] $m4k05 = $m4k[5] $m4k06 = $m4k[6] $m4k07 = $m4k[7] $m4k08 = $m4k[8] $m4k09 = $m4k[9] Global $Mode4Array = [$m4k00, $m4k01, $m4k02, $m4k03, $m4k04, $m4k05, $m4k06, $m4k07, $m4k08, $m4k09] ; Mode 4 Global $replace4Array[11][2] = [[$m4k00, ""], [$m4k01, ""], [$m4k02, ""], [$m4k03, ""], [$m4k04, ""], [$m4k05, ""], [$m4k06, ""], [$m4k07, ""], [$m4k08, ""], [$m4k09, ""], ["_", " "]] ; Mode 4 MsgBox(0,0,$m4k06) ElseIf GUICtrlRead($inifile4) = 1 Then $m4k = IniReadSection($file4, "mode 4") $m4k = _ArrayExtract($m4k, 1, -1, 1, 1) $m4k00 = $m4k[0] $m4k01 = $m4k[1] $m4k02 = $m4k[2] $m4k03 = $m4k[3] $m4k04 = $m4k[4] $m4k05 = $m4k[5] $m4k06 = $m4k[6] $m4k07 = $m4k[7] $m4k08 = $m4k[8] $m4k09 = $m4k[9] Global $Mode4Array = [$m4k00, $m4k01, $m4k02, $m4k03, $m4k04, $m4k05, $m4k06, $m4k07, $m4k08, $m4k09] ; Mode 4 Global $replace4Array[11][2] = [[$m4k00, ""], [$m4k01, ""], [$m4k02, ""], [$m4k03, ""], [$m4k04, ""], [$m4k05, ""], [$m4k06, ""], [$m4k07, ""], [$m4k08, ""], [$m4k09, ""], ["_", " "]] ; Mode 4 MsgBox(0,0,$m4k08) EndIf Case $scramble $plaintext = GUICtrlRead($entry) ;ConsoleWrite($plaintext) $fillgaps = StringReplace($plaintext, " ", "_") ;ConsoleWrite($fillgaps) GUICtrlSetData($entry, $fillgaps) $plaintext = GUICtrlRead($entry) ;ConsoleWrite($plaintext) $Str = $plaintext $Arr = StringSplit($Str, "") ;_ArrayDisplay($Arr) $Arr[0] = "" ; ============================================================ Mode 1: If $modus1 = 1 Then $FirstIndex = $Mode1Array Global $NewString = "" Global $a = $FirstIndex $Raws = UBound($Arr) For $i = 1 To $Raws Step 1 $a -= 1 If $a = 0 Then $a = $FirstIndex $NewString = $NewString & $Arr[$i - 1] & $Mode1Array[$a - 1] Next ; ============================================================ Mode 2: ElseIf $modus2 = 2 Then $SecondIndex = $Mode2Array Global $NewString = "" Global $b = $SecondIndex $Raws = UBound($Arr) For $i = 1 To $Raws Step 1 $b -= 1 If $b = 0 Then $b = $SecondIndex $NewString = $NewString & $Arr[$i - 1] & $Mode2Array[$b - 1] Next ; ============================================================ Mode 3: ElseIf $modus3 = 3 Then $ThirdIndex = $Mode3Array Global $NewString = "" Global $c = $ThirdIndex $Raws = UBound($Arr) For $i = 1 To $Raws Step 1 $c -= 1 If $c = 0 Then $c = $ThirdIndex $NewString = $NewString & $Arr[$i - 1] & $Mode3Array[$c - 1] Next ; ============================================================ Mode 4: ElseIf $modus4 = 4 Then $ForthIndex = $Mode4Array Global $NewString = "" Global $d = $ForthIndex $Raws = UBound($Arr) For $i = 1 To $Raws Step 1 $d -= 1 If $d = 0 Then $d = $ForthIndex $NewString = $NewString & $Arr[$i - 1] & $Mode4Array[$d - 1] Next EndIf If $modus1 = 1 Then GUICtrlSetData($entry, $NewString) If $modus2 = 2 Then GUICtrlSetData($entry, $NewString) If $modus3 = 3 Then GUICtrlSetData($entry, $NewString) If $modus4 = 4 Then GUICtrlSetData($entry, $NewString) Case $descramble $scrambletext = GUICtrlRead($entry) ;ConsoleWrite($scrambletext) ;$Str = $scrambletext ;$Arr = StringSplit($Str, "") ;_ArrayDisplay($Arr) If $modus1 = 1 Then $descramble1 = $scrambletext For $i = 0 To Ubound($replace1Array, 1) - 1 $descramble1 = StringRegExpReplace($descramble1, "\Q" & $replace1Array[$i][0] & "\E", $replace1Array[$i][1]) Next ElseIf $modus2 = 2 Then $descramble2 = $scrambletext For $i = 0 To Ubound($replace2Array, 1) - 1 $descramble2 = StringRegExpReplace($descramble2, "\Q" & $replace2Array[$i][0] & "\E", $replace2Array[$i][1]) Next ElseIf $modus3 = 3 Then $descramble3 = $scrambletext For $i = 0 To Ubound($replace3Array, 1) - 1 $descramble3 = StringRegExpReplace($descramble3, "\Q" & $replace3Array[$i][0] & "\E", $replace3Array[$i][1]) Next ElseIf $modus4 = 4 Then $descramble4 = $scrambletext For $i = 0 To Ubound($replace4Array, 1) - 1 $descramble4 = StringRegExpReplace($descramble4, "\Q" & $replace4Array[$i][0] & "\E", $replace4Array[$i][1]) Next EndIf If $modus1 = 1 Then GUICtrlSetData($entry, $descramble1) If $modus2 = 2 Then GUICtrlSetData($entry, $descramble2) If $modus3 = 3 Then GUICtrlSetData($entry, $descramble3) If $modus4 = 4 Then GUICtrlSetData($entry, $descramble4) EndSwitch WEnd there is now only one bug left, that i can not fix or do not know how to fix. the reset case ... i have marked the error and i just do not understand why it will not reset the modus back to unchecked. can someone please just help me with the unchecking of the radio buttons from the modus setting? everything else i am quite happy with. i think i have made it further than i expected and currently i am about 92% finished. just need some minor changes here and there and then it is finished. please just help me with the reset case (reset button), thanks. kind regards
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