kylomas Posted January 10, 2013 Share Posted January 10, 2013 (edited) telmob, I can't follow your code. The following code displays a password dialog as a result of a tray action. If the passwaord is correct it then displays another dialog. This seems to be what you are after. Perhaps you can adapt some of this to your code. expandcollapse popup; *** Start added by AutoIt3Wrapper *** #include <EditConstants.au3> #include <GUIConstantsEx.au3> ; *** End added by AutoIt3Wrapper *** #include <Constants.au3> #NoTrayIcon #AutoIt3Wrapper_Add_Constants=n Opt("TrayOnEventMode", 1) Opt("TrayMenuMode", 1) TrayCreateItem("Config App") TrayItemSetOnEvent(-1, "Password") TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "_Exit") TraySetState() While 1 Sleep(10000) WEnd func Password() local $gui010 = guicreate('Password Validation',150,100) local $pswd = GUICtrlCreateInput('Enter Password',10,10,130,20,$es_password) local $pbtn = GUICtrlCreatebutton('Validate Password',10,30,130,20) local $status = GUICtrlCreatelabel('',10,90,130,20) guisetstate() while 1 switch guigetmsg() case $pbtn if guictrlread($pswd) = 'password' Then guidelete($gui010) _config() return Else GUICtrlSetData($status,'Invalid Password') guictrlsetdata($pswd,'') guictrlsetstate($pswd,$gui_focus) endif case $gui_event_close guidelete($gui010) return endswitch wend endfunc func _config() local $gui020 = guicreate('Config Dialog') guisetstate() while 1 switch guigetmsg() Case $gui_event_close guidelete($gui020) Return EndSwitch WEnd endfunc func _exit() ConsoleWrite('Exiting...' & @LF) Exit endfunc Good Luck, kylomas Edited January 10, 2013 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 10, 2013 Moderators Share Posted January 10, 2013 telmob, That code is all over the place. How do you expect the password in the input to be checked if you do not show the password GUI so that the user can enter something before checking? Try this and see if it works as you require: expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GUIComboBox.au3> #include <Constants.au3> #include <GUIListview.au3> #include <Array.au3> #include <File.au3> #include <Crypt.au3> Opt("WinTitleMatchMode", 2) Opt("TrayAutoPause", 0) Opt("TrayIconHide", 0) Opt("TrayOnEventMode", 1) TrayMenu("create") TraySetClick(8) TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE, "On_DblClick"); ----<-----<-----<-----<-----<-----<-----<-----<---- $FormPasswidth = 280 $FormPassheight = 121 $FormPass = GUICreate("fghjfghjfgj", 280, 121, @DesktopWidth / 2 - $FormPasswidth / 2, @DesktopHeight / 2 - $FormPassheight / 2, BitOR($WS_SYSMENU, $GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)) $PassInput = GUICtrlCreateInput("", 8, 29, 257, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD)) $ButtonsubmitPass = GUICtrlCreateButton("&OK", 110, 58, 75, 28, $BS_NOTIFY) $ButtonCancelPass = GUICtrlCreateButton("&Cancel", 191, 58, 75, 28, $BS_NOTIFY) $EnterPassLabel = GUICtrlCreateLabel("Enter password:", 8, 12, 130, 17, 0) GUISetState(@SW_HIDE) $SRPEGUI = GUICreate("App", 200, 200, 500, 500, BitOR($WS_EX_ACCEPTFILES, $WS_EX_WINDOWEDGE, $GUI_SS_DEFAULT_GUI)) $ButtonLockSystem = GUICtrlCreateButton("Lock System", 54, 80, 91, 28) GUISetState(@SW_HIDE) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $ButtonsubmitPass SubmitPass() EndSwitch WEnd Func On_DblClick() GUISetState(@SW_SHOW, $FormPass) If SubmitPass() Then MsgBox(0, "Password", "Good") Else MsgBox(0, "Password", "Bad") ;GUISetState(@SW_SHOW, $SRPEGUI) EndIf EndFunc ;==>On_DblClick Func SubmitPass(); ----<-----<-----<-----<-----<-----<-----<-----<---- Local $Pass = 1 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $ButtonCancelPass GUISetState(@SW_HIDE, $FormPass) Return False Case $ButtonsubmitPass Local $PassInputRead = GUICtrlRead($PassInput) GUICtrlSetData($PassInput, "") GUISetState(@SW_HIDE, $FormPass) ExitLoop EndSwitch WEnd If $PassInputRead = $Pass Then Return True ElseIf $PassInputRead <> $Pass Then Return False EndIf EndFunc ;==>SubmitPass Func TrayMenu($tAction = "create") Opt("TrayMenuMode", 11) TrayItemSetOnEvent(-1, "TrayClick") $t_settings = TrayCreateItem("Configure") TrayItemSetOnEvent(-1, "TrayClick") TrayCreateItem("") $t_exit = TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "TrayClick") TraySetState() EndFunc ;==>TrayMenu Func TrayClick() $t_msg = TrayItemGetText(@TRAY_ID) Select Case $t_msg = "Configure" Local $state = WinGetState("App", "") If WinExists("App", "") Then GUISetState(@SW_HIDE, $SRPEGUI) ElseIf Not WinExists("App", "") Then GUISetState(@SW_SHOW, $SRPEGUI) EndIf Case $t_msg = "Exit" Exit EndSelect EndFunc ;==>TrayClick Any better? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
telmob Posted January 10, 2013 Author Share Posted January 10, 2013 Solved! I'm tremendously happy. Yep, my code was a mess, sorry about that. Thank you so much Melba and kylomas!!! 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