Jump to content

Drop down menu to read from a .txt file to replace input box


 Share

Recommended Posts

  • Moderators

ragiroti,

Not a good idea in my opinion as you will never be able to tell if the user has finished entering data. You risk moving away from the dialog before the user has finished entering his required data. ;)

I would do something like this:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIComboBox.au3>
#include <EditConstants.au3>

$hGUI = GUICreate("Set Parameters", 600, 500, -1, -1, $WS_CAPTION)

GUICtrlCreateLabel("What are you testing in this build?", 10, 10, 300, 20)
$hEdit = GUICtrlCreateEdit("", 10, 40, 480, 100, $ES_MULTILINE)
GUICtrlCreateLabel("YYYYYY" & @CRLF &  "Please enter the '<1> <2> <3> <4> <5> <6>'", 10, 150, 250, 40)
$spnumber = GUICtrlCreateInput("", 10, 190, 100, 20)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetLimit(-1, 6)
GUICtrlCreateLabel("Environment" & @CRLF & "Please choose the Environment", 10, 220, 250, 40)
$environment = GUICtrlCreateCombo("", 10, 260, 100, 20)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetData(-1, "PC|Win 7|Win XP")
GUICtrlCreateLabel("Developer" & @CRLF & "Please choose the Developer Name", 250, 150, 250, 40)
$developer = GUICtrlCreateCombo("", 260, 190, 100, 20)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetData(-1, "aaa|BBB|CCC|DDD|EEE|FFF")
GUICtrlCreateLabel("Tester" & @CRLF & "Please choose the Tester Name", 260, 220, 250, 40)
$tester = GUICtrlCreateCombo("", 260, 260, 100, 20)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetData(-1, "GGG|HHH|III|JJJ")
;GUICtrlCreateLabel("Date" & @CRLF &  "Please enter the date in the following format 'dd-mm-yyyy'", 10, 290, 250, 40)
;$date = GUICtrlCreateInput("", 10, 340, 100, 20)
;GUICtrlSetLimit(-1, 10)

GUISetState()

$fDisabled = True

While 1

    ; Set the check to 0
    $iCheck = 0
    ; Enable the other controls if we have at least 10 characters in the edit
    If StringLen(GUICtrlRead($hEdit)) > 10 Then
        ; If edit has some text then enable the other controls
        If $fDisabled Then
            For $i = $spnumber To $tester
                GUICtrlSetState($i, $GUI_ENABLE)
            Next
            $fDisabled = False
        EndIf
    EndIf
    ; Check to see if all conditions met
    If StringLen(GUICtrlRead($spnumber)) = 6 Then $iCheck += 1
    If GUICtrlRead($environment) <> "" And _GUICtrlComboBox_GetDroppedState($environment) = False Then $iCheck += 1
    If GUICtrlRead($developer) <> "" And _GUICtrlComboBox_GetDroppedState($developer) = False Then $iCheck += 1
    If GUICtrlRead($tester) <> "" And _GUICtrlComboBox_GetDroppedState($tester) = False Then $iCheck += 1
    ; If we have all 4 checks we are good to go
    If $iCheck = 4 Then
        $spnumber = GUICtrlRead($spnumber)
        $environment = GUICtrlRead($environment)
        $developer = GUICtrlRead($developer)
        $tester = GUICtrlRead($tester)
        $date = @MDAY & "-" & @MON & "-" & @YEAR
        ; Delete the GUI
        GUIDelete($hGUI)
        ; And continue on our way
        ExitLoop
    EndIf

WEnd

$sString = _
"=============================================================================================================================================================" & @CRLF & _
"Sprint Number: " & $spnumber & @CRLF & _
"Exploratory Test Sessions" & @CRLF & _
"=============================================================================================================================================================" & @CRLF & _
"Environment: " & $environment & @CRLF & _
"Developer: " & $developer & @CRLF & _
"Project: aaaaaaaaaaaa" & @CRLF & _
"Tester: " & $tester & @CRLF & _
"Date: " & $date & @CRLF

ConsoleWrite($sString & @CRLF)

Now the user has to enter at least 10 characters (you can adjust this of course) in the edit box first because nothing else works until they are entered. Then we check the other 4 items are correctly actioned and off we go. As I assume we will always want today's date, I have also made the date entry automatic - we are talking Auto(mate)It here! :idiot:

How does that look? :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

ragiroti,

could I use it for automating the current time also?

Of course - go and look at the Help file under <Macro Reference - Time And Date Macros>. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...