Jump to content
nooneclose

[SOLVED] How to tell Autoit that "A" is different than "a"

Recommended Posts

nooneclose
Posted (edited)

I am sure you guys know of a simple solution but I am still kind of new to AutoIt and its special functions. I want my code to be able to know how to encrypt and decrypt "A" and "a" as two different chars.

my code is very long so here is just a snippet/example of it.  

;Encode==
Global $charAA   = "" ; ( Capital letter A )   = Global 184 = ¸    ( Cedilla )
           $charAA   = $charAA & Chr(65)           
Global $chara    = "" ; ( Lowercase letter a ) = Global 251 = û    ( û Latin Small Letter U With Circumflex )
           $chara    = $chara & Chr(97)
           
;Decode==  
Global $ch184 = ""          ;( Copyright symbol ) = $charAA
           $ch184 = $ch184 & Chr(184)          
Global $ch251 = ""          ;( û Latin Small Letter U With Circumflex ) = $chara
           $ch251 = $ch251 & Chr(251)

;Encode==          
stringreplace($test_String, $charAA, $ch184)
stringreplace($test_String, $chara,  $ch251)

;Decode==
stringreplace($$new_String, $ch184, $charAA)
stringreplace($$new_String, $ch251, $chara)

NOTE: my stringreplace function is nested in my actual code. I only separated them here for readability. )


I know there are better ways to Encrypt and Decrypt a message but I'm doing this as a fun side project for me and a select group of friends to enjoy. 

Again My code is not encrypting or decrypting capitals and lower case properly even though I use their ANSI codes. 

 

Example: Input "A a B b"  Encrypt: ". . $ $"  Decrypt: "A A B B"

Any and all help will be greatly appreciated.  

Edited by nooneclose

Share this post


Link to post
Share on other sites
nooneclose

@RTFC Thank you for replying to my post in a timely manner. Can you show me an example of how that might look in a nested stringreplace function? 

stringreplace(stringreplace(stringreplace($test_String, $charAA, $ch184), $chara,  $ch251), $charBB, $char195, $STR_CASESENSE = 1)

Would I place the $STR_CASESENSE = 1 at the end like the example above? or at the end of each nested section? 

Share this post


Link to post
Share on other sites
nooneclose

@water could you answer the previous question I had about where to put the $STR_CASESENSE = 1

Share this post


Link to post
Share on other sites
water

You are using the parameter the wrong way: Just 1, not $str_casesense=1

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Malkey

It appears you need to understand the AutoIt help file.
Look up the StringReplace function in the AutoIt help file.  (Cursor over StringReplace in SciTE and press F1 key)

See "StringReplace ( "string", "searchstring/start", "replacestring" [, occurrence = 0 [, casesense = 0]] )

Note: the square barackets around the two last optional parameters, each show their default values of zero.  
When the 5th parameter, casesense, needs to be 1, the 0ptional 4th parameter will be need to be in place in order to identify the 5th parameter.
In the include file "StringConstants.au3" you will find the variable, "$STR_CASESENSE" equal to 1. So, the 5th parameter can be "$STR_CASESENSE" or "1", they are the same value.

Also note:-
Return Value
Returns the new string .... 

#include <StringConstants.au3>

 ; Variable $Encode contains the new string
$Encode = StringReplace(StringReplace(StringReplace($test_String, $charAA, $ch184, 0, $STR_CASESENSE), $chara, $ch251, 0, $STR_CASESENSE), $charBB, $char195, 0, $STR_CASESENSE)

 

  • Thanks 1

Share this post


Link to post
Share on other sites
nooneclose

@water @Malkey Thank you both very much for your help and thank you again @Malkey for your detailed explanation that really helped me to get the code to work right. Sadly, I do have to add the 0, 1) at the end of each nested line but this is a small price to pay for working code.

 

Example of final working code:

stringreplace(stringreplace(stringreplace($test_String, $charAA, $ch184, 0, 1), $chara,  $ch251, 0, 1), $charBB, $char195, 0, 1)

   

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

  • Similar Content

    • SC0U7
      By SC0U7
      Hello i have a text file which contain over 600KB of BASE64 strings like :
      TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
      Now what i need is divide this long string as autoit variable each max lenght (4000characters per line) example:
      Local $var
      $var &=  TVqQAAMAAAAEAAA..
      $var &=  VbAmejwqqqAACEE..
      and then how to i add encrypt function on every line ? how to i can xor it? example final will be :
      $var &=  XorEnc(TVqQAAMAAAAEAAA..)
      $var &=  XorEncVbAmejwqqqAACEE..)
       
      Thanks for any help and ideas 
    • FMS
      By FMS
      Hello,
      I think this is a simple question if you know the answer.
      At this function i try to  (encrypt -> decrypt -> change -> encrypt ->decrypt->check ) an array.
      This is a snippet from a larger script but the error is the same.
      I do this encrypt decrypt action so i can save some setting along the way in a file.
      But at the end (when i change the data and not when i dont change the data) is empty.
      does somebody see what i'm doing wrong here?
       
      Func test() Local $LC_timestamp = @MDAY & "." & @MON & "." & @YEAR & "_" & @HOUR & ":" & @MIN & ":" & @SEC Global $GL_USS_base_count = 4 Global $GL_USS_base[$GL_USS_base_count][2] = [["nickname", "FMS"], ["last_login", $LC_timestamp], ["login_count", "1" ], ["naam3", $LC_timestamp]] Global $encrypted_GL_USS_true[$GL_USS_base_count] Global $encrypted_GL_USS_content_true[$GL_USS_base_count] Global $GL_array_decrypted_USS_names[$GL_USS_base_count] Global $GL_array_decrypted_USS_settings[$GL_USS_base_count] MsgBox($MB_SYSTEMMODAL, "should be 1", $GL_USS_base[2][1]) ;make for $i = 0 to $GL_USS_base_count -1 $encrypted_GL_USS_true[$i] = _Crypt_EncryptData($GL_USS_base[$i][0], $GL_encr_key_settings, $CALG_AES_128) $encrypted_GL_USS_content_true[$i] = _Crypt_EncryptData($GL_USS_base[$i][1], $GL_encr_key_settings, $CALG_AES_128) Next ;get for $i = 0 to $GL_USS_base_count -1 $GL_array_decrypted_USS_names[$i] = binarytostring(_Crypt_DecryptData(binary($encrypted_GL_USS_true[$i]), $GL_encr_key_settings, $CALG_AES_128)) $GL_array_decrypted_USS_settings[$i] = binarytostring(_Crypt_DecryptData(binary($encrypted_GL_USS_content_true[$i]), $GL_encr_key_settings, $CALG_AES_128)) Next MsgBox($MB_SYSTEMMODAL, "should be 1", $GL_array_decrypted_USS_settings[2]) ;change $GL_array_decrypted_USS_settings[2] = $GL_array_decrypted_USS_settings[2] + "1" MsgBox($MB_SYSTEMMODAL, "should be 2", $GL_array_decrypted_USS_settings[2]) ;save for $i = 0 to $GL_USS_base_count -1 $encrypted_GL_USS_true[$i] = _Crypt_EncryptData($GL_array_decrypted_USS_names[$i], $GL_encr_key_settings, $CALG_AES_128) $encrypted_GL_USS_content_true[$i] = _Crypt_EncryptData($GL_array_decrypted_USS_settings[$i], $GL_encr_key_settings, $CALG_AES_128) Next ;get for $i = 0 to $GL_USS_base_count -1 $GL_array_decrypted_USS_names[$i] = binarytostring(_Crypt_DecryptData(binary($encrypted_GL_USS_true[$i]), $GL_encr_key_settings, $CALG_AES_128)) $GL_array_decrypted_USS_settings[$i] = binarytostring(_Crypt_DecryptData(binary($encrypted_GL_USS_content_true[$i]), $GL_encr_key_settings, $CALG_AES_128)) Next ;check MsgBox($MB_SYSTEMMODAL, "should be 2", $GL_array_decrypted_USS_settings[2]) ;why is this emty????? EndFunc thanks in advanced
    • caramen
      By caramen
      Hello guys. 
      I totaly reworked a script to get less problem(Melba23) and i used a topic to copy an existing script and modified it. 
      Since my last post it was bad evaluated as a spam bot but by my fault since i have not explained the purpose of it corectly. (Yes i got ugly english)
       
      Then FIRST OF ALL the purpose of this script is to allow a call center to complet multiple fields in internet explorer and optionnaly; i am gonna see that after the principal code to configure multiple email that can be send. I know there is some UDF for outlook etc... but i want a single script to do all. this is the way i want to do that. 
       
      Ok this is my complete code for the moment. 
      #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> $dll = DllOpen("user32.dll") Global $EnvoyerMess1Sub1 Global $EnvoyerMess2Sub1 Global $EnvoyerMess3Sub1 Global $EnvoyerMess4Sub1 Global $EnvoyerMess5Sub1 Global $EnvoyerMess1Sub2 Global $EnvoyerMess2Sub2 Global $EnvoyerMess3Sub2 Global $EnvoyerMess4Sub2 Global $EnvoyerMess5Sub2 Global $EnvoyerMess1Sub3 Global $EnvoyerMess2Sub3 Global $EnvoyerMess3Sub3 Global $EnvoyerMess4Sub3 Global $EnvoyerMess5Sub3 Global $EnvoyerMess1Sub4 Global $EnvoyerMess2Sub4 Global $EnvoyerMess3Sub4 Global $EnvoyerMess4Sub4 Global $EnvoyerMess5Sub4 Global Const $SettingsFile = @SCRIPTDIR & '\Settings.ini' $Setting1 = IniRead ($SettingsFile, 'Stats', 'Utilisation', "ERROR") IniWrite ($SettingsFile, 'Stats', 'Utilisation',$Setting1+1) $Valeur1 = IniRead ($SettingsFile, 'NomMenu', 'Menu1', "ERROR") $Valeur2 = IniRead ($SettingsFile, 'NomMenu', 'Menu2', "ERROR") $Valeur3 = IniRead ($SettingsFile, 'NomMenu', 'Menu3', "ERROR") $Valeur4 = IniRead ($SettingsFile, 'NomMenu', 'Menu4', "ERROR") $Valeur11 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu1.1', "ERROR") $Valeur12 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu1.2', "ERROR") $Valeur13 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu1.3', "ERROR") $Valeur14 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu1.4', "ERROR") $Valeur15 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu1.5', "ERROR") $Valeur21 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu2.1', "ERROR") $Valeur22 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu2.2', "ERROR") $Valeur23 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu2.3', "ERROR") $Valeur24 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu2.4', "ERROR") $Valeur25 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu2.5', "ERROR") $Valeur31 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu3.1', "ERROR") $Valeur32 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu3.2', "ERROR") $Valeur33 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu3.3', "ERROR") $Valeur34 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu3.4', "ERROR") $Valeur35 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu3.5', "ERROR") $Valeur41 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu4.1', "ERROR") $Valeur42 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu4.2', "ERROR") $Valeur43 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu4.3', "ERROR") $Valeur44 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu4.4', "ERROR") $Valeur45 = IniRead ($SettingsFile, 'NomMenu', 'SousMenu4.5', "ERROR") $Message11 = IniRead ($SettingsFile, 'Messages', 'Message11', "ERROR") $Message12 = IniRead ($SettingsFile, 'Messages', 'Message11', "ERROR") $Message13 = IniRead ($SettingsFile, 'Messages', 'Message11', "ERROR") $Message14 = IniRead ($SettingsFile, 'Messages', 'Message11', "ERROR") $Message15 = IniRead ($SettingsFile, 'Messages', 'Message11', "ERROR") $Message21 = IniRead ($SettingsFile, 'Messages', 'Message21', "ERROR") $Message22 = IniRead ($SettingsFile, 'Messages', 'Message22', "ERROR") $Message23 = IniRead ($SettingsFile, 'Messages', 'Message23', "ERROR") $Message24 = IniRead ($SettingsFile, 'Messages', 'Message24', "ERROR") $Message25 = IniRead ($SettingsFile, 'Messages', 'Message25', "ERROR") $Message31 = IniRead ($SettingsFile, 'Messages', 'Message31', "ERROR") $Message32 = IniRead ($SettingsFile, 'Messages', 'Message32', "ERROR") $Message33 = IniRead ($SettingsFile, 'Messages', 'Message33', "ERROR") $Message34 = IniRead ($SettingsFile, 'Messages', 'Message34', "ERROR") $Message35 = IniRead ($SettingsFile, 'Messages', 'Message35', "ERROR") $Message41 = IniRead ($SettingsFile, 'Messages', 'Message41', "ERROR") $Message42 = IniRead ($SettingsFile, 'Messages', 'Message42', "ERROR") $Message43 = IniRead ($SettingsFile, 'Messages', 'Message43', "ERROR") $Message44 = IniRead ($SettingsFile, 'Messages', 'Message44', "ERROR") $Message45 = IniRead ($SettingsFile, 'Messages', 'Message45', "ERROR") BuildHiddenGUI() While 1 Sleep ( 10 ) If _IsPressed("04", $dll) Then CallCustomContextMenu() $msg = GUIGetMsg() Switch $msg ;~ ===================================================== Case $EnvoyerMess1Sub1 ;~ MouseClick("left") Send(""&$Message11) Case $EnvoyerMess2Sub1 Send(""&$Message12) Case $EnvoyerMess3Sub1 Send(""&$Message13) Case $EnvoyerMess4Sub1 Send(""&$Message14) Case $EnvoyerMess5Sub1 Send(""&$Message15) ;~ ====================================================== Case $EnvoyerMess1Sub2 Case $EnvoyerMess2Sub2 Case $EnvoyerMess3Sub2 Case $EnvoyerMess4Sub2 Case $EnvoyerMess5Sub2 ;~ ====================================================== Case $EnvoyerMess1Sub3 Case $EnvoyerMess2Sub3 Case $EnvoyerMess3Sub3 Case $EnvoyerMess4Sub3 Case $EnvoyerMess5Sub3 ;~ ======================================================= Case $EnvoyerMess1Sub4 Case $EnvoyerMess2Sub4 Case $EnvoyerMess3Sub4 Case $EnvoyerMess4Sub4 Case $EnvoyerMess5Sub4 ;~ ====================================================== Case $ConfigITEM EndSwitch WEnd DllClose($dll) Func BuildHiddenGUI() Global $Contextmenu, $msg, $GUI, $aTSR Global $SubMenu1, $folderitem, $programitem, $fileitem, $ConfigITEM, $otheritem Global $folderitem1, $folderitem2, $programitem1, $programitem2 $aTSR = _GetTotalScreenResolution() $GUI = GuiCreate("GUI Context Menu",1,1, $aTSR[0], 1,BitOR($WS_POPUP,$WS_BORDER),BitOr($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) WinSetTrans( $GUI, '', 1) GUISetState() $Contextmenu = GUICtrlCreateContextMenu() $SubMenu1 = GUICtrlCreateMenu(""&$Valeur1, $Contextmenu) $EnvoyerMess1Sub1 = GUICtrlCreateMenuItem(""&$Valeur11, $SubMenu1) $EnvoyerMess2Sub1 = GUICtrlCreateMenuItem(""&$Valeur12, $SubMenu1) $EnvoyerMess3Sub1 = GUICtrlCreateMenuItem(""&$Valeur13, $SubMenu1) $EnvoyerMess4Sub1 = GUICtrlCreateMenuItem(""&$Valeur14, $SubMenu1) $EnvoyerMess5Sub1 = GUICtrlCreateMenuItem(""&$Valeur15, $SubMenu1) $SubMenu2 = GUICtrlCreateMenu(""&$Valeur2, $Contextmenu) $EnvoyerMess1Sub2 = GUICtrlCreateMenuItem(""&$Valeur21, $SubMenu2) $EnvoyerMess2Sub2 = GUICtrlCreateMenuItem(""&$Valeur22, $SubMenu2) $EnvoyerMess3Sub2 = GUICtrlCreateMenuItem(""&$Valeur23, $SubMenu2) $EnvoyerMess4Sub2 = GUICtrlCreateMenuItem(""&$Valeur24, $SubMenu2) $EnvoyerMess5Sub2 = GUICtrlCreateMenuItem(""&$Valeur25, $SubMenu2) $SubMenu3 = GUICtrlCreateMenu(""&$Valeur3, $Contextmenu) $EnvoyerMess1Sub3 = GUICtrlCreateMenuItem(""&$Valeur31, $SubMenu3) $EnvoyerMess2Sub3 = GUICtrlCreateMenuItem(""&$Valeur32, $SubMenu3) $EnvoyerMess3Sub3 = GUICtrlCreateMenuItem(""&$Valeur33, $SubMenu3) $EnvoyerMess4Sub3 = GUICtrlCreateMenuItem(""&$Valeur34, $SubMenu3) $EnvoyerMess5Sub3 = GUICtrlCreateMenuItem(""&$Valeur35, $SubMenu3) $SubMenu4 = GUICtrlCreateMenu(""&$Valeur4, $Contextmenu) $EnvoyerMess1Sub4 = GUICtrlCreateMenuItem(""&$Valeur41, $SubMenu4) $EnvoyerMess2Sub4 = GUICtrlCreateMenuItem(""&$Valeur42, $SubMenu4) $EnvoyerMess3Sub4 = GUICtrlCreateMenuItem(""&$Valeur43, $SubMenu4) $EnvoyerMess4Sub4 = GUICtrlCreateMenuItem(""&$Valeur44, $SubMenu4) $EnvoyerMess5Sub4 = GUICtrlCreateMenuItem(""&$Valeur45, $SubMenu4) GUICtrlCreateMenuItem("", $contextmenu) ; separator $ConfigITEM = GUICtrlCreateMenuItem("Configuration", $contextmenu) EndFunc Func CallCustomContextMenu() Local $contextmenu, $msg Global $newsubmenu, $folderitem, $programitem, $fileitem, $otheritem Global $folderitem1, $folderitem2, $programitem1, $programitem2 Local $pos Global $GUI, $aTSR WinActivate ($GUI) ControlClick ( $GUI, "", "", "right", 1, $aTSR[0], 1) EndFunc Func _GetTotalScreenResolution() Local $aRet[2], $VirtualDesktopWidth, $VirtualDesktopHeight Global Const $SM_VIRTUALWIDTH = 78 Global Const $SM_VIRTUALHEIGHT = 79 $VirtualDesktopWidth = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALWIDTH) $aRet[0] = $VirtualDesktopWidth[0] $VirtualDesktopHeight = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT) $aRet[1] = $VirtualDesktopHeight[0] Return $aRet EndFunc Func WinGroupActive() AutoItSetOption("WinTitleMatchMode", 4) If WinActive("classname=ExploreWClass") _ Or WinActive("classname=CabinetWClass") _ Or WinActive("classname=#32770") _ Or WinActive("classname=DV2ControlHost") _ Or WinActive("classname=MMCMainFrame") _ Or WinActive("[CLASS:Progman; Title:Program Manager]") Then Return True Else Return False EndIf EndFunc  
      By this way the script is very more clear about the purpose. When i use middle mouse click i got a context menu that apear. Then i can send the preconfigured message in the ini file that will alow me to send particular message without spending much time on it. 
      First question : 
      When i push middle click on a particular windows how to get back focus on it ??
      plz dont make attention on the declared fonction that are unused i am gonna clean that at the end. 
    • FMS
      By FMS
      Hello,

      I'm having trouble whit a scipt what I'm building where this is a snippit from, and hope somebody can help me whit.
      The problem lies in when i push the "add" button i want to check if the "user" already exists.
      But the search code i build founds 2 hits when i know there is only 1 hit.
      does somebody knows what I'm doing wrong?
      thanks in advance.

      Ps. if somebody knows " if i found the right user how can i rewrite the password for him/her? " an answer to that will be most appriciated
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <AutoItConstants.au3> #include <Array.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <File.au3> #Include <Timers.au3> #include <Crypt.au3> #include <GuiEdit.au3> $Form1 = GUICreate("Pie", 170, 235, 190, 200) local $usernames[0] local $passwords[0] global $selectuser = GUICtrlCreateCombo("", 21, 95, 130, 20) $addusername = GUICtrlCreateButton("Add", 21, 170, 130, 30) $usernamefield = GUICtrlCreateInput("", 21, 120, 130, 20) $passwordfield = GUICtrlCreateInput("", 21, 145, 130, 20, 0x0020) func encrypt() Local $hFileOpen = FileOpen("data.srmt", $FO_APPEND) if guictrlread($usernamefield) <> "" then ;~ local $encryptedusername = string(guictrlread($usernamefield)) ;~ local $encryptedpassword = string(guictrlread($passwordfield)) local $encryptedusername = string(_Crypt_EncryptData(guictrlread($usernamefield), "P14h735536jk3fvvbg", $CALG_AES_128)) local $encryptedpassword = string(_Crypt_EncryptData(guictrlread($passwordfield ), "P14h735536jk3fvvbg", $CALG_AES_128)) Local $iCheck_hit = False ConsoleWrite (@CRLF & "##############################################"& @CRLF) if ubound($usernames)> 0 then for $i = 0 to ubound($usernames)-1 If guictrlread($usernamefield) = $usernames[$i] Then $iCheck_hit = True ConsoleWrite ( "Found! "& @CRLF & $usernames[$i] & " = " & guictrlread($usernamefield) & @CRLF & "i = " & $i & @CRLF & @CRLF) ;~ Else ;~ ConsoleWrite ( "No! "& @CRLF & $usernames[$i] & " = " & guictrlread($usernamefield) & @CRLF & "i = " & $i & @CRLF & @CRLF) EndIf next EndIf ConsoleWrite ( "##############################################"& @CRLF) If $iCheck_hit = False Then FileWrite($hFileOpen, $encryptedusername & @CRLF) FileWrite($hFileOpen, $encryptedpassword & @CRLF) EndIf EndIf FileClose($hFileOpen) EndFunc func decrypt() Local $hFileOpen = FileOpen("data.srmt", $FO_READ) ;~ consolewrite(_FileCountLines("data.srmt") & " lines in the file" & @CRLF) for $i = 1 to _FileCountLines("data.srmt")/2 local $encryptedusername = FileReadLine($hFileOpen) local $encryptedpassword = FileReadLine($hFileOpen) ;~ consolewrite($encryptedusername & @CRLF) ;~ consolewrite($encryptedpassword & @CRLF) ;~ _ArrayAdd($usernames, FileReadLine($hFileOpen)) ;~ _ArrayAdd($passwords, FileReadLine($hFileOpen)) _ArrayAdd($usernames, binarytostring(_Crypt_DecryptData(binary($encryptedusername), "P14h735536jk3fvvbg", $CALG_AES_128))) _ArrayAdd($passwords, binarytostring(_Crypt_DecryptData(binary($encryptedpassword), "P14h735536jk3fvvbg", $CALG_AES_128))) Next FileClose($hFileOpen) ;~ consolewrite(ubound($usernames) & " entries in array") ;~ _arraydisplay($usernames) if ubound($userNames)> 0 then for $i = 0 to ubound($usernames)-1 GUICtrlSetData($selectuser, $usernames[$i]) next EndIf endfunc func updatecomboandinfo() if not GUICtrlRead($usernamefield) = "" Then _ArrayAdd($usernames, GUICtrlRead($usernamefield)) _ArrayAdd($passwords, GUICtrlRead($passwordfield)) GUICtrlSetData($selectuser, $usernames[UBound($usernames)-1]) EndIf EndFunc decrypt() GUISetState(@SW_SHOW) While True $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $addusername updatecomboandinfo() encrypt() GUICtrlSetData($usernamefield, "") GUICtrlSetData($passwordfield, "") Case $selectuser if ubound($usernames)> 0 then for $i = 0 to ubound($usernames)-1 ;~ msg( "error",$array_decrypted_usernames[$i]) If $usernames[$i] = GUICtrlRead($selectuser) Then GUICtrlSetData($usernamefield, $usernames[$i]) GUICtrlSetData($passwordfield, $passwords[$i]) consolewrite("YES " & $i & " = " & $usernames[$i] & " | ctr = " & GUICtrlRead($selectuser) & @CRLF) Else ;~ msg( "error",$array_decrypted_usernames[$i]) consolewrite("NO " & $i & " = " & $usernames[$i] & " | ctr = " & GUICtrlRead($selectuser) & @CRLF) EndIf next EndIf EndSwitch WEnd  
×