31290 Posted November 13, 2015 Share Posted November 13, 2015 Hi there I'm writing a cript that need to validate users' credentials.One simple thing is that if "User" & "Password" fileds are empty, a msgbox pops to ask for credentials.So far, I have:Func f_Login() Global $LoginfoGUI = GUICreate("Account Info", 300, 300, -1, -1) GUISetIcon ($resources & "login.ico") GUISetFont(8.5, 700, 0) GUICtrlCreatePic ($resources & "\SAClogo.jpg", 30, 10, 240, 80) GUISetBkColor ($Color_White) GUICtrlCreateLabel("--- SEE UNINSTALLER ---", 85, 100, 150, 25) GUICtrlCreateLabel("Please provide _a account:", 10, 130, 250, 25) GUICtrlSetColor(-1, $COLOR_RED) GUICtrlCreateLabel("-Global ID:", 10, 170, 60, 30) GUICtrlCreateLabel("-Password:", 10, 210, 70, 30) GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") Global $GIDTechInput = GUICtrlCreateInput("", 90, 168, 80, 20) Global $PassInput = GUICtrlCreateInput("", 90, 205, 150, 20, $ES_PASSWORD) $submitBtn = GUICtrlCreateButton ("Submit", 100, 245, 100, 25, $BS_DEFPUSHBUTTON) GUICtrlSetState(-1, $GUI_FOCUS) GUICtrlSetOnEvent(-1, "f_UninstallerMainGUI") GUISetState() If GUICtrlRead($PassInput) <> "" And Not BitAnd(GUICtrlGetState($submitBtn), $GUI_ENABLE) Then GUICtrlSetState($submitBtn, $GUI_ENABLE) EndFunc Func f_UninstallerMainGUI() If (GuiCtrlRead($GIDTechInput)) OR (GUICtrlRead($PassInput)) = "" Then MsgBox (16, "ACCESS DENIED", "Please provide credentials") RestartScript() Else CODE CONTINUES EndIf EndFuncBut even if the fields are not empty, the msgbox pops up and the script no longer execute...#include <GUIConstantsEx.au3> is declared.I don't know what's happening here.Can you please give a hand on this one?thanks ~~~ Doom Shall Never Die, Only The Players ~~~ Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 13, 2015 Moderators Share Posted November 13, 2015 31290,Your comparison statement is wrong - you need to check the contents of both inputs separately:If (GuiCtrlRead($GIDTechInput) = "") OR (GUICtrlRead($PassInput) = "") ThenM23 31290 1 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...
alexandruc Posted November 13, 2015 Share Posted November 13, 2015 (edited) If (GuiCtrlRead($GIDTechInput)) OR (GUICtrlRead($PassInput)) = "" ThenYour script evaluates the if and since it does read the input (GuiCtrlRead($GIDTechInput)) it returns true and the popup appears.just use:$GIDTechInput = GuiCtrlRead($GIDTechInput) $PassInput = GuiCtrlRead($PassInput) If $PassInput = "" OR $GIDTechInput = "" Then ... EndIForIf (GuiCtrlRead($GIDTechInput)) = "" OR (GUICtrlRead($PassInput)) = "" Thensorry, haven't noticed Melba23 answered already... Edited November 13, 2015 by alexandruc 31290 1 Link to comment Share on other sites More sharing options...
31290 Posted November 13, 2015 Author Share Posted November 13, 2015 Thanks a lot guys for your inputs!Now I know that I hav to separate operations for things to work! Cheers ~~~ Doom Shall Never Die, Only The Players ~~~ 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