Jump to content

v0id

Members
  • Posts

    6
  • Joined

  • Last visited

v0id's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thanks, made it work!
  2. I am starting out using AutoIt. Here is a simple form with username and password. I want to check if information entered is valid once user clicks a button. My problem now is that it only validates once. E.g.: if I type 5 character username, it will complain it is not 7 character (good). But once I correct that mistake and press the button again it will still say the same thing. Do I need to have a loop? #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <MsgBoxConstants.au3> Opt("GUIOnEventMode", 1) $main = GUICreate("Test Tool", 600, 600) $hyourlabel = GUICtrlCreateLabel("YOUR CREDENTIALS", 30, 10, 256) GUICtrlSetFont($hyourlabel, Default, 600) Local $adminfrejalabel = GUICtrlCreateLabel("Username:", 8, 38, 64, 17) Global $adminfrejaid = GUICtrlCreateInput("", 80, 38, 110, 17) Local $adminpasswordlabel = GUICtrlCreateLabel("Password:", 8, 62, 64, 17) Global $adminpassword = GUICtrlCreateInput("", 80, 62, 110, 17, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL)) $userButton_Check = GUICtrlCreateButton("VALIDATE", 32, 480, 85, 25) GUICtrlSetOnEvent($userButton_Check, "startvalidation") GUISetOnEvent($GUI_EVENT_CLOSE, "ExitGUI") GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func startvalidation() ;CHECK VALIDATIONS $adminfrejaid = GUICtrlRead($adminfrejaid) $adminpassword = GUICtrlRead($adminpassword) If StringLen($adminfrejaid) <> '7' Then MsgBox($MB_SYSTEMMODAL, "User ID", "Please enter exactly 7 characters.") ;Exit EndIf If StringLen($adminpassword) < '5' Then MsgBox($MB_SYSTEMMODAL, "Your Password", "Please enter a valid password.") ;Exit EndIf EndFunc Func ExitGui () Exit ; Exit the program EndFunc
  3. Thanks, and for those who need the code: #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> Opt("GUIOnEventMode", 1) $main = GUICreate("Basic Template", 400, 300) $edit = GUICtrlCreateEdit("", 10, 80, 380, 140) $button = GUICtrlCreateButton("Press me!", 320, 260, 70, 25) GUICtrlSetOnEvent($button, "ButtonFunction") GUISetOnEvent($GUI_EVENT_CLOSE, "ExitGUI") GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func ButtonFunction() $data = GUICtrlRead($edit) $aArray = StringSplit($data, @CRLF, $STR_ENTIRESPLIT) For $i = 1 To $aArray[0] ; Loop through the array returned by StringSplit to display the individual values. MsgBox($MB_SYSTEMMODAL, "", "$aArray[" & $i & "] - " & $aArray[$i]) Next EndFunc Func ExitGui () Exit ; Exit the program EndFunc
  4. No code, just question in general. Let's say we have Edit field $textarea = GUICtrlCreateEdit('', 100, 10, 200, 100) If I type the following into this edit field: test1 test2 I want for an array to contain test1 and test2 (so I could grab the values later). Obviously if I type 5 lines of text I want array to contain 5 entries etc etc. What is the best way to go about this?
  5. I think I fixed it with declaring global variables before the function: <...> GUISetState(@SW_SHOW) Global $SVECheckBox Global $FINCheckBox Global $DANCheckBox Global $NORCheckBox UserType() Func UserType() <...> Now I need for CreateEdit to appear. The way I did right now is like this: Select Case $SVECheckBox And BitAND(GUICtrlRead($SVECheckBox), $GUI_CHECKED) = $GUI_CHECKED ;MsgBox(4096, "SVE checked", "Box1 is checked.") Local $SVEMyedit = GUICtrlCreateEdit("First line" & @CRLF, 8, 360, 122, 97, $ES_AUTOVSCROLL + $WS_VSCROLL) Send("{END}") GUICtrlSetData($SVEMyedit, "Second line", 1) <...> But it does not work for multiple checkboxes. Any hints? example.au3
  6. I have this script. My intention: if you select Regular user and then check box SVE, for example, it gives a text area. Same for FIN or DAN or NOR. So if I select 3 checkboxes - 3 text areas should appear beneath the checkboxes. I tried with another Select (testing with MsgBox for now: Select Case $SVECheckBox And BitAND(GUICtrlRead($SVECheckBox), $GUI_CHECKED) = $GUI_CHECKED MsgBox(4096, "SVE checked", "Box1 is checked.") EndSelect But it did not work. Tried with If statement - still no result. What am I doing wrong? (full script attached) example.au3
×
×
  • Create New...