supersonic Posted May 15, 2008 Share Posted May 15, 2008 hi when the script (see bottom) is freshly started i can't encode the input by just pressing enter. only some chars where selected. i always have to click "Encrypt" manually. afterwards it's possible to encode the input by just pressing enter. what's wrong with it? expandcollapse popup#include <Array.au3> #include <File.au3> #include <GUIComboBox.au3> #include <GUIConstants.au3> #include <GUIListView.au3> #include <String.au3> ; Preserve order of variables! Global $programCopyright = Chr(169) & " " & @YEAR & " dummyTEXT" ; Asc("©") Global $programName = "dummyNAME" ; <...> Global $kgGUI = GUICreate($programName, 400, 86, -1, -1) Global $kgInput1 = GUICtrlCreateInput("", 1, 1, 336, 21, $ES_PASSWORD) Global $kgInput2 = GUICtrlCreateInput("", 1, 24, 336, 21) Global $kgInput3 = GUICtrlCreateInput("", 1, 47, 336, 21) Global $kgButton1 = GUICtrlCreateButton("Encrypt", 339, 1, 60, 21) Global $kgButton2 = GUICtrlCreateButton("Clipboard", 339, 24, 60, 21) Global $kgButton3 = GUICtrlCreateButton("Reset", 339, 47, 60, 21) Global $kgLabel = GUICtrlCreateLabel($programCopyright, 1, 70, 398, 15, $SS_CENTER) AutoItSetOption("GUIOnEventMode", 1) ; Opt AutoItSetOption("TrayIconHide", 1) ; Opt AutoItSetOption("WinTitleMatchMode", -2) ; Opt Func kgClipboard() $kgCB = GUICtrlRead($kgInput2) If $kgCB <> "" Then ClipPut($kgCB) GUICtrlSetData($kgInput1, "") GUICtrlSetData($kgInput2, "") GUICtrlSetData($kgInput3, "") GUICtrlSetState($kgButton2, $GUI_DISABLE) GUICtrlSetState($kgButton3, $GUI_DISABLE) GUICtrlSetState($kgInput1, $GUI_FOCUS) EndIf EndFunc Func kgEncrypt() $kgDummy = GUICtrlRead($kgInput1) If $kgDummy <> "" Then ; $encoded = _StringEncrypt(1, $kgDummy, FileRead(FileOpen(@ScriptDir & "\netlogon.key", 0))) $encoded = _StringEncrypt(1, $kgDummy, "dummyPW") ; $decoded = _StringEncrypt(0, $encoded, FileRead(FileOpen(@ScriptDir & "\netlogon.key", 0))) $decoded = _StringEncrypt(0, $encoded, "dummyPW") FileClose(-1) GUICtrlSetData($kgInput1, "") GUICtrlSetData($kgInput2, $encoded) GUICtrlSetData($kgInput3, $decoded) GUICtrlSetState($kgButton2, $GUI_ENABLE) GUICtrlSetState($kgButton3, $GUI_ENABLE) GUICtrlSetState($kgInput1, $GUI_FOCUS) EndIf EndFunc Func kgReset() GUICtrlSetData($kgInput1, "") GUICtrlSetData($kgInput2, "") GUICtrlSetData($kgInput3, "") GUICtrlSetState($kgButton2, $GUI_ENABLE) GUICtrlSetState($kgButton3, $GUI_ENABLE) GUICtrlSetState($kgInput1, $GUI_FOCUS) EndFunc Func exitProgram() GUIDelete($kgGUI) Exit EndFunc GUICtrlSetBkColor($kgLabel, 0x484848) GUICtrlSetColor($kgLabel, 0xFFFFFF) GUICtrlSetFont($kgLabel, 8.5, 400, "System") GUICtrlSetOnEvent($kgButton1, "kgEncrypt") GUICtrlSetOnEvent($kgButton2, "kgClipboard") GUICtrlSetOnEvent($kgButton3, "kgReset") GUICtrlSetState($kgButton2, $GUI_DISABLE) GUICtrlSetState($kgButton3, $GUI_DISABLE) GUICtrlSetState($kgInput1, $GUI_FOCUS) GUICtrlSetState($kgInput2, $GUI_DISABLE) GUICtrlSetState($kgInput3, $GUI_DISABLE) GUISetOnEvent($GUI_EVENT_CLOSE, "exitProgram") GUISetState(@SW_SHOW, $kgGUI) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Link to comment Share on other sites More sharing options...
i542 Posted May 15, 2008 Share Posted May 15, 2008 (edited) You need $BS_DEFPUSHBUTTON style That makes Encrypt button that will be executed on Enter. Edited May 15, 2008 by i542 I can do signature me. Link to comment Share on other sites More sharing options...
supersonic Posted May 15, 2008 Author Share Posted May 15, 2008 it work's! ... but after clicking Clipboard/Reset it doesn't. Any ideas?You need $BS_DEFPUSHBUTTON style That makes Encrypt button that will be executed on Enter. Link to comment Share on other sites More sharing options...
ProgAndy Posted May 15, 2008 Share Posted May 15, 2008 in Beta, you could use GUISetAccelerators to Set ENTER as Hotkey in the GUI *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
supersonic Posted May 15, 2008 Author Share Posted May 15, 2008 (edited) hm... seems to be more a workaround, not a real solution.i'm using the latest stable release.in Beta, you could use GUISetAccelerators to Set ENTER as Hotkey in the GUI Edited May 15, 2008 by supersonic Link to comment Share on other sites More sharing options...
supersonic Posted May 15, 2008 Author Share Posted May 15, 2008 when Clipboard/Reset was pressed $BS_DEFPUSHBUTTON seems to be disabled???You need $BS_DEFPUSHBUTTON style That makes Encrypt button that will be executed on Enter. Link to comment Share on other sites More sharing options...
supersonic Posted May 15, 2008 Author Share Posted May 15, 2008 i solved it so far with GUICtrlSetStyle() Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now