NewCoder_ Posted October 6, 2023 Share Posted October 6, 2023 (edited) expandcollapse popup#include <GUIConstants.au3> #include <ColorConstants.au3> #include <MsgBoxConstants.au3> #include <ButtonConstants.au3> #include <ColorConstants.au3> #include <AutoItConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> ; Declare the control ID as a global variable Func Delete_User() Local $hGUI = GUICreate("Delete User", 300, 250, -1, -1) Local $label = GUICtrlCreateLabel("Write your Username in wich you want to delete. If you have a Gramatic error it wont delete the user. If you need help contact IT member Alexander Wiens. (Interna 7312)", 50, 70, 200, 80) Local $username = GUICtrlCreateInput("", 50, 10, 200, 20) Local $userpasscode = GUICtrlCreateInput("", 50, 40, 200, 20, $ES_PASSWORD) Local $button_delete = GUICtrlCreateButton("Delete", 170, 150, 60, 40) Local $button_exit = GUICtrlCreateButton("Exit", 80, 150, 60, 40) GUICtrlSetColor($button_delete, 0xFF2D00) GUICtrlSetColor($button_exit, 0x00F00) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $button_exit Exit Case $button_delete $existsuser = IniRead("C:\Users\Alexander_2 Wiens\Documents\Data-User\USER.properties", $username, "User", False) $rightpassword = IniRead("C:\Users\Alexander_2 Wiens\Documents\Data-User\USER.properties", $username, "Passcode", False) MsgBox($MB_OK, "Read", $existsuser) If $existsuser == $username Then MsgBox($MB_OK, "Tada", "More Tada") ElseIf $existsuser == False Then MsgBox($MB_OK, "ERROR", "The user or the passcode is wrong") ElseIf $existsuser == "aw08" Then MsgBox($MB_OK, "ERROR", "That is wierd!") Else MsgBox($MB_OK, "ERROR", "I don't get it...") EndIf EndSwitch WEnd EndFunc Delete_User() I am having Problems with my script. I am not long on Autoit and i dont get the result i am expecting from the script. I have saved example user and i want to add the option to delete one. The thing is i havent found out yet how i compare the User with the saved one and see if the passwort meets the saved one to delete the user. Edited October 6, 2023 by NewCoder_ Link to comment Share on other sites More sharing options...
Solution Andreik Posted October 6, 2023 Solution Share Posted October 6, 2023 (edited) expandcollapse popup#include <GUIConstants.au3> #include <ColorConstants.au3> #include <MsgBoxConstants.au3> #include <ButtonConstants.au3> #include <ColorConstants.au3> #include <AutoItConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> ; Declare the control ID as a global variable Func Delete_User() Local $hGUI = GUICreate("Delete User", 300, 250, -1, -1) Local $label = GUICtrlCreateLabel("Write your Username in wich you want to delete. If you have a Gramatic error it wont delete the user. If you need help contact IT member Alexander Wiens. (Interna 7312)", 50, 70, 200, 80) Local $username = GUICtrlCreateInput("", 50, 10, 200, 20) Local $userpasscode = GUICtrlCreateInput("", 50, 40, 200, 20, $ES_PASSWORD) Local $button_delete = GUICtrlCreateButton("Delete", 170, 150, 60, 40) Local $button_exit = GUICtrlCreateButton("Exit", 80, 150, 60, 40) GUICtrlSetColor($button_delete, 0xFF2D00) GUICtrlSetColor($button_exit, 0x00F00) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $button_exit Exit Case $button_delete $sUsername = GUICtrlRead($username) ; << ----- You need to read the text from the control $sPassword = GUICtrlRead($userpasscode) ; << ----- You need to read the text from the control $existsuser = IniRead("C:\Users\Alexander_2 Wiens\Documents\Data-User\USER.properties", $sUsername, "User", False) ; << -- Use it here $rightpassword = IniRead("C:\Users\Alexander_2 Wiens\Documents\Data-User\USER.properties", $sUsername, "Passcode", False) ; << -- And here MsgBox($MB_OK, "Read", $existsuser) If $existsuser == $sUsername Then ; << ----- Compare with what you read from control MsgBox($MB_OK, "Tada", "More Tada") ElseIf $existsuser == False Then MsgBox($MB_OK, "ERROR", "The user or the passcode is wrong") ElseIf $existsuser == "aw08" Then MsgBox($MB_OK, "ERROR", "That is wierd!") Else MsgBox($MB_OK, "ERROR", "I don't get it...") EndIf EndSwitch WEnd EndFunc Delete_User() Edited October 6, 2023 by Andreik NewCoder_ 1 When the words fail... music speaks. 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