Moderators Melba23 Posted February 18, 2009 Moderators Share Posted February 18, 2009 TheOnlyOne, Can you see the problem now?Case $login $Form2 = GUICreate("Login", 360, 329, 193, 125,BitOR($WS_CAPTION,$WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS)) GUISetBkColor(0xA6CAF0) $enterpassword=GUICtrlCreateInput("", 24, 40, 265, 19) ;<<<<<<<<<<<<<<<< Password GUICtrlSetFont(-1, 8, 800, 2, "Gulim") GUICtrlSetColor(-1, 0x800000) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKHEIGHT) $Label1 = GUICtrlCreateLabel("Username", 24, 16, 52, 17) ;<<<<<<<<<<<<<<<< Username $enterusername=GUICtrlCreateInput("", 24, 96, 265, 19) ;<<<<<<<<<<<<<<<Username GUICtrlSetFont(-1, 8, 800, 2, "Gulim") GUICtrlSetColor(-1, 0x800000) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKHEIGHT) $Label2 = GUICtrlCreateLabel("Password", 24, 72, 82, 17) ;<<<<<<<<<<<<<<< Password $loginButton1 = GUICtrlCreateButton("(Not allowed)", 24, 136, 158, 37, BitOR($BS_BITMAP,$WS_BORDER), $WS_EX_STATICEDGE) GUICtrlSetImage(-1, "C:\Documents and Settings\lo\Skrivebord\game menu\Login2.bmp", 0) GUISetState(@SW_SHOW) Try to space out your code to make it easier to read (and find errors like this one!) - personally I find that grouping the elements of a GUI as I have done in the example above works well. 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...
TheOnlyOne Posted February 18, 2009 Author Share Posted February 18, 2009 sorry to say but i still cant see whats wrong you say there are 2 usernames and 2 passwords :/ but the one of the usernames and one of the passwords are just labels what you mean by that? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 18, 2009 Moderators Share Posted February 18, 2009 TheOnlyOne,You are reading the "Username" from the input labelled "Password" - and the "Password" from the input labelled "Username".So when you input the "Username" and "Password", these values are being read into the wrong variables.Just switch the labels and all will be well.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...
TheOnlyOne Posted February 18, 2009 Author Share Posted February 18, 2009 like this ? Case $login $Form2 = GUICreate("Login", 360, 329, 193, 125,BitOR($WS_CAPTION,$WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS)) GUISetBkColor(0xA6CAF0) $enterpassword=GUICtrlCreateInput("", 24, 40, 265, 19) ;<<<<<<<<<<<<<<<< Password GUICtrlSetFont(-1, 8, 800, 2, "Gulim") GUICtrlSetColor(-1, 0x800000) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKHEIGHT) $Label2 = GUICtrlCreateLabel("Password", 24, 72, 82, 17) ;<<<<<<<<<<<<<<< Password $enterusername=GUICtrlCreateInput("", 24, 96, 265, 19) ;<<<<<<<<<<<<<<<Username GUICtrlSetFont(-1, 8, 800, 2, "Gulim") GUICtrlSetColor(-1, 0x800000) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKHEIGHT) $Label1 = GUICtrlCreateLabel("Username", 24, 16, 52, 17) ;<<<<<<<<<<<<<<<< Username $loginButton1 = GUICtrlCreateButton("(Not allowed)", 24, 136, 158, 37, BitOR($BS_BITMAP,$WS_BORDER), $WS_EX_STATICEDGE) GUICtrlSetImage(-1, "C:\Documents and Settings\lo\Skrivebord\game menu\Login2.bmp", 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### for that is still the same mistake :S? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 18, 2009 Moderators Share Posted February 18, 2009 TheOnlyOne, Have you tried that code to see if it is correct? Always a good idea before replying! Yes, that should now work - if you put the correct values in the correct inputs! 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...
TheOnlyOne Posted February 19, 2009 Author Share Posted February 19, 2009 it dont work still when i just set my username to sss and pass to 123 then it still dont work :S and i need to ask why did i need to switch username label and password label before. for the i allready set the position ? so cant see why that can make a error ? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 19, 2009 Moderators Share Posted February 19, 2009 TheOnlyOne,This works for me! Compare it with your script and see the differenceexpandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Include <File.au3> #include <Array.au3> If Not FileExists(("C:\Documents and Settings\lo\Skrivebord\game menu\users") Then DirCreate(("C:\Documents and Settings\lo\Skrivebord\game menu\users") Global $aUsername_Array[1] = [0], $aPassword_Array[1] = [0] $2=fileopen(("C:\Documents and Settings\lo\Skrivebord\game menu\users\password.txt",1) $1=fileopen(("C:\Documents and Settings\lo\Skrivebord\game menu\users\username.txt",1) global $avArray[1] #Region ### START Koda GUI section ### Form=c:\documents and settings\lo\skrivebord\form2.kxf $Form1_1 = GUICreate("Form1", 628, 299, 193, 125) GUISetBkColor(0xA6CAF0) $register = GUICtrlCreateButton("Register", 24, 24, 186, 71, BitOR($BS_BITMAP,$WS_BORDER), $WS_EX_STATICEDGE) GUICtrlSetImage(-1, ("C:\Documents and Settings\lo\Skrivebord\game menu\register-icon.bmp", 0) $login = GUICtrlCreateButton("LogIn", 24, 112, 184, 77, BitOR($BS_BITMAP,$WS_BORDER), $WS_EX_STATICEDGE) GUICtrlSetImage(-1, ("C:\Documents and Settings\lo\Skrivebord\game menu\Login!.bmp", 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $press= GUIGetMsg() Switch $press Case $GUI_EVENT_CLOSE Exit Case $register GUISetState(@SW_hide,$Form1_1) $Form3 = GUICreate("register", 308, 220, 178, 116,BitOR($WS_CAPTION,$WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS)) GUISetBkColor(0xA6CAF0) $chooseusername= GUICtrlCreateInput("", 32, 56, 241, 21) $Label1 = GUICtrlCreateLabel("Choose your username.", 32, 32, 163, 16) GUICtrlSetFont(-1, 9, 800, 0, "Gulim") $Label2 = GUICtrlCreateLabel("Choose your password.", 33, 111, 162, 16) GUICtrlSetFont(-1, 9, 800, 0, "Gulim") $choosepassword=GUICtrlCreateInput("", 30, 131, 241, 21) $registerButton1 = GUICtrlCreateButton("Register", 40, 168, 67, 20, $BS_BITMAP, $WS_EX_CLIENTEDGE) GUICtrlSetImage(-1, ("C:\Documents and Settings\lo\Skrivebord\game menu\register-icon-small.bmp", 0) $backButton = GUICtrlCreateButton("Back", 176, 168, 65, 22, $BS_BITMAP, $WS_EX_CLIENTEDGE) GUICtrlSetImage(-1, ("C:\Documents and Settings\lo\Skrivebord\game menu\back.bmp", 0) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $backButton GUISetState(@SW_SHOW,$Form1_1) GUISetState(@SW_hide,$Form3) ExitLoop Case $registerButton1 ; Here we add the new username and password to the files where they are stored ; Read the files into the arrays _FileReadToArray(("C:\Documents and Settings\lo\Skrivebord\game menu\users\username.txt",$aUsername_Array) _FileReadToArray(("C:\Documents and Settings\lo\Skrivebord\game menu\users\password.txt",$aPassword_Array) ; Get the variables $username=GUICtrlRead($chooseusername) $password=GUICtrlRead($choosepassword) ; Add them to the arrays _ArrayAdd($aUsername_Array, $username) _ArrayAdd($aPassword_Array, $password) ; Increase the count of the elements $aUsername_Array[0] += 1 $aPassword_Array[0] += 1 ; Write the files again _FileWriteFromArray(("C:\Documents and Settings\lo\Skrivebord\game menu\users\username.txt",$aUsername_Array, 1) _FileWriteFromArray(("C:\Documents and Settings\lo\Skrivebord\game menu\users\password.txt",$aPassword_Array, 1) ; Return automatically GUISetState(@SW_SHOW,$Form1_1) GUISetState(@SW_hide,$Form3) ExitLoop EndSwitch WEnd Case $login $Form2 = GUICreate("Login", 360, 329, 193, 125,BitOR($WS_CAPTION,$WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS)) GUISetBkColor(0xA6CAF0) $enterusername=GUICtrlCreateInput("", 24, 40, 265, 19) GUICtrlSetFont(-1, 8, 800, 2, "Gulim") GUICtrlSetColor(-1, 0x800000) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKHEIGHT) $Label1 = GUICtrlCreateLabel("Username", 24, 16, 52, 17) $enterpassword=GUICtrlCreateInput("", 24, 96, 265, 19) GUICtrlSetFont(-1, 8, 800, 2, "Gulim") GUICtrlSetColor(-1, 0x800000) GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKHEIGHT) $Label2 = GUICtrlCreateLabel("Password", 24, 72, 82, 17) $loginButton1 = GUICtrlCreateButton("(Not allowed)", 24, 136, 158, 37, BitOR($BS_BITMAP,$WS_BORDER), $WS_EX_STATICEDGE) GUICtrlSetImage(-1, ("C:\Documents and Settings\lo\Skrivebord\game menu\Login2.bmp", 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Switch GUIGetMsg() Case $loginButton1 ; Here we search for the username and password in the files where they are stored ; Read the files into the arrays _FileReadToArray(("C:\Documents and Settings\lo\Skrivebord\game menu\users\username.txt",$aUsername_Array) _FileReadToArray(("C:\Documents and Settings\lo\Skrivebord\game menu\users\password.txt",$aPassword_Array) ; Get the variables $username=GUICtrlRead($enterusername) $password=GUICtrlRead($enterpassword) ; Now look for the username in the array $index = _ArraySearch($aUsername_Array, $username) ; If username is not found If $index = -1 Then ; Say it was wrong MsgBox(0,"error", "Username does not exist") ; Go back GUISetState(@SW_SHOW,$Form1_1) GUISetState(@SW_hide,$Form2) ExitLoop EndIf ; username was found, so compare password to matching index in password array If $password <> $aPassword_Array[$index] Then ; Say if it was wrong MsgBox(0,"Error", "Incorrect password") ; Go back GUISetState(@SW_SHOW,$Form1_1) GUISetState(@SW_hide,$Form2) ExitLoop EndIf ; If we are here, everything is good! GUICtrlSetData($loginButton1, "Please Login") ; here you can put your code for a successful login ; For the moment we just say so! MsgBox(0,"Success", "Please Login") GUISetState(@SW_SHOW,$Form1_1) GUISetState(@SW_hide,$Form2) ExitLoop EndSwitch WEnd ExitLoop EndSwitch WEnd fileclose($1) fileclose($2) 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...
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