home *** CD-ROM | disk | FTP | other *** search
/ PC World 2006 February / PCWorld_2006-02_cd.bin / software / vyzkuste / triky / triky.exe / autoit-v3-setup.exe / Examples / encrypt.au3 < prev    next >
Text File  |  2005-01-19  |  3KB  |  80 lines

  1. ;====================================================
  2. ;============= Encryption Tool With GUI ============= 
  3. ;====================================================
  4. ; AutoIt version: 3.0.103
  5. ; Language:       English
  6. ; Author:         "Wolvereness"
  7. ;
  8. ; ----------------------------------------------------------------------------
  9. ; Script Start
  10. ; ----------------------------------------------------------------------------
  11. #include <guiconstants.au3>
  12. #include <string.au3>
  13. ;#include files for encryption and GUI constants
  14. ;~~
  15. $WinMain = GuiCreate('Encryption tool', 400, 400)
  16. ; Creates window
  17. ;~~
  18. $EditText = GuiCtrlCreateEdit('',5,5,380,350)
  19. ; Creates main edit
  20. ;~~
  21. $InputPass = GuiCtrlCreateInput('',5,360,100,20, 0x21)
  22. ; Creates the password box with blured/centered input
  23. ;~~
  24. $InputLevel = GuiCtrlCreateInput(1, 110, 360, 50, 20, 0x2001)
  25. $UpDownLevel = GUICtrlSetLimit(GuiCtrlCreateUpDown($inputlevel),10,1)
  26. ; These two make the level input with the Up|Down ability
  27. ;~~
  28. $EncryptButton = GuiCtrlCreateButton('Encrypt', 170, 360, 105, 35)
  29. $DecryptButton = GuiCtrlCreateButton('Decrypt', 285, 360, 105, 35)
  30. ; Encryption/Decryption buttons
  31. ;~~
  32. GUICtrlCreateLabel('Password', 5, 385)
  33. GuiCtrlCreateLabel('Level',110,385)
  34. ; Simple text labels so you know what is what
  35. ;~~
  36. GuiSetState()
  37. ; Shows window
  38. ;~~
  39.  
  40. Do
  41.    $Msg = GuiGetMsg()
  42.    If $msg = $EncryptButton Then
  43.      ; When you press Encrypt
  44.      ;~~
  45.       GuiSetState(@SW_DISABLE,$WinMain)
  46.      ; Stops you from changing anything
  47.      ;~~
  48.       $string = GuiCtrlRead($EditText)
  49.      ; Saves the editbox for later
  50.      ;~~
  51.       GUICtrlSetData($EditText,'Please wait while the text is Encrypted/Decrypted.')
  52.      ; Friendly message
  53.      ;~~
  54.       GuiCtrlSetData($EditText,_StringEncrypt(1,$string,GuiCtrlRead($InputPass),GuiCtrlRead($InputLevel)))
  55.      ; Calls the encryption. Sets the data of editbox with the encrypted string
  56.      ;~~
  57.       GuiSetState(@SW_ENABLE,$WinMain)
  58.      ; This turns the window back on
  59.      ;~~
  60.    EndIf
  61.    If $msg = $DecryptButton Then
  62.      ; When you press Decrypt
  63.      ;~~
  64.       GuiSetState(@SW_DISABLE,$WinMain)
  65.      ; Stops you from changing anything
  66.      ;~~
  67.       $string = GuiCtrlRead($EditText)
  68.      ; Saves the editbox for later
  69.      ;~~
  70.       GUICtrlSetData($EditText,'Please wait while the text is Encrypted/Decrypted.')
  71.      ; Friendly message
  72.      ;~~
  73.       GuiCtrlSetData($EditText,_StringEncrypt(0,$string,GuiCtrlRead($InputPass),GuiCtrlRead($InputLevel)))
  74.      ; Calls the encryption. Sets the data of editbox with the encrypted string
  75.      ;~~
  76.       GuiSetState(@SW_ENABLE,$WinMain)
  77.      ; This turns the window back on
  78.      ;~~
  79.    EndIf
  80. Until $msg = $GUI_EVENT_CLOSE; Continue loop untill window is closed