#Include "C:\AutoIt\autoit-v3\com\Include\Default.au3" _HotKeySet() $ini = @ScriptDir & "\encryption.ini" If Not FileExists($ini) Then _FileCreate($ini) IniWrite($ini, "Settings", "passwort", "w84Mg38I2ETv") EndIf $pw = _DecryptString(IniRead ( $ini, "Settings", "passwort", "w84Mg38I2ETv" ), "P1100") AutoItSetOption("TrayMenuMode", 1) ;$traymenu = TrayCreateMenu("Encryption") ;$encrypt = TrayCreateItem("Verschlüssle");, $traymenu) ;$decrypt = TrayCreateItem("Entschlüssle");, $traymenu) $cryptGUI = TrayCreateItem("Ver-/Entschlüssle mit GUI");, $traymenu) $separator1 = TrayCreateItem("") $exit_tray = TrayCreateItem("Beenden") While 1 Sleep(5) $msg = TrayGetMsg() ;If $msg = $encrypt Then EncryptSelected() ;If $msg = $encrypt Then DecryptSelected() If $msg = $cryptGUI Then GUISelected() If $msg = $exit_tray Then ExitScript() WEnd Func EncryptSelected() _HotKeyReset() SplashTextOn ("Verschlüssle Text", "Bitte warten, der Text wird verschlüsselt." , 400 , 50) $wintitle = WinGetTitle("") Send("^c") Sleep(250) $text = ClipGet() If Not @error Then $encrypted = _EncryptString($text, $pw) If Not @error Then WinActivate($wintitle) If ClipPut($encrypted) Then Send("^v") EndIf EndIf SplashOff() _HotKeySet() EndFunc Func DecryptSelected() _HotKeyReset() SplashTextOn ("Entschlüssle Text", "Bitte warten, der Text wird entschlüsselt." , 400 , 50) $wintitle = WinGetTitle("") Send("^c") $text = ClipGet() Sleep(250) If Not @error Then $encrypted = _DecryptString($text, $pw) If Not @error Then WinActivate($wintitle) If ClipPut($encrypted) Then Send("^v") EndIf EndIf SplashOff() _HotKeySet() EndFunc Func ExitScript() _HotKeyReset() Exit EndFunc Func GUISettings() _HotKeyReset() $gui = GUICreate("Ver- / Entschlüsselungsoptionen", 190, 90, @DesktopWidth - 195, @DesktopHeight - 125, $WS_DLGFRAME, $WS_EX_TOPMOST ) $button_ok = GUICtrlCreateButton("OK", 5, 45, 50, 20, $BS_DEFPUSHBUTTON) $button_cancel = GUICtrlCreateButton("Abbrechen", 60, 45, 80, 20) $label_passwort = GUICtrlCreateLabel("Passwort:", 5, 5, 80, 15) $input_passwort = GUICtrlCreateInput($pw, 5, 20, 180, 20) _GUIAnimateWindow($gui, $AW_DIAG_SLIDE_IN_BOTTOMRIGHT, 250) GUISetState() While 1 Sleep(5) $msg = GUIGetMsg() If $msg = $button_cancel Then _GUIAnimateWindow($gui, $AW_DIAG_SLIDE_OUT_BOTTOMRIGHT, 500) ExitLoop EndIf If $msg = $button_ok Then If Not GUICtrlRead($input_passwort) = "" Then $pw = GUICtrlRead($input_passwort) IniWrite($ini, "Settings", "passwort", _EncryptString(GUICtrlRead($input_passwort),"P1100")) _GUIAnimateWindow($gui, $AW_DIAG_SLIDE_OUT_BOTTOMRIGHT, 500) ExitLoop Else MsgBox(262144, "Fehler!", "Kein Passwort angegeben.") ControlFocus ( "", "", $input_passwort ) EndIf EndIf If $msg = $GUI_EVENT_CLOSE Then _GUIAnimateWindow($gui, $AW_DIAG_SLIDE_OUT_BOTTOMRIGHT, 500) ExitLoop EndIf WEnd GUIDelete($gui) _HotKeySet() EndFunc Func GUISelected() _HotKeyReset() ;$wintitle = WinGetTitle("") Send("^c") $gui = GUICreate("GUI Ver- und Entschlüsselung", 800, 480, -1, 0) $input_text = GUICtrlCreateInput("",5,5,790,400,BitOr($ES_MULTILINE,$ES_WANTRETURN,$ES_AUTOVSCROLL)) $label_passwort = GUICtrlCreateLabel("Passwort:", 5, 413, 50, 20) $input_passwort = GUICtrlCreateInput($pw, 60, 410, 335) $button_encrypt = GUICtrlCreateButton("Verschlüsseln", 5, 440, 190, 30) $button_decrypt = GUICtrlCreateButton("Entschlüsseln", 205, 440, 190, 30) ;GUISetState() $text = ClipGet() If Not @error Then GUICtrlSetData($input_text, $text) EndIf _GUIAnimateWindow($gui, $AW_SLIDE_IN_TOP, 250) WinActivate("GUI Ver- und Entschlüsselung") GUISetState() While 1 $msg = GUIGetMsg() Sleep(5) If $msg = $button_encrypt Then GUICtrlSetData($input_text, _EncryptString(GUICtrlRead($input_text), GUICtrlRead($input_passwort))) If $msg = $button_decrypt Then GUICtrlSetData($input_text, _DecryptString(GUICtrlRead($input_text), GUICtrlRead($input_passwort))) If $msg = $GUI_EVENT_CLOSE Then _GUIAnimateWindow($gui, $AW_SLIDE_OUT_TOP, 500) ExitLoop EndIf WEnd GUIDelete($gui) _HotKeySet() EndFunc Func _HotKeySet() HotkeySet("#q", "ExitScript") HotkeySet("#y", "EncryptSelected") HotkeySet("#x", "DecryptSelected") HotkeySet("#c", "GUISelected") HotkeySet("#s", "GUISettings") EndFunc Func _HotKeyReset() HotkeySet("#q") HotkeySet("#y") HotkeySet("#x") HotkeySet("#c") HotkeySet("#s") EndFunc