Sign in to follow this  
Followers 0
Rishav

Capturing F1 key press (CLOSED)

11 posts in this topic

#1 ·  Posted (edited)

Hi folks

In a UI i am working now, i am trying to capture the F1 key to bring up an "About" popup.

While 1
    $msg = GUIGetMsg(1)

    Switch $msg[0]
        Case $msg= "{F1}"
            msgbox(0,"","ITS ALIVE!!!")
        Endswitch
Wend

the above code doesn't really works. can anyone tell me what I am doing wrong?

thanks and regards

Rishav

Edited by Rishav

Share this post


Link to post
Share on other sites



Hi folks

In a UI i am working now, i am trying to capture the F1 key to bring up an "About" popup.

While 1
    $msg = GUIGetMsg(1)

    Switch $msg[0]
        Case $msg= "{F1}"
            msgbox(0,"","ITS ALIVE!!!")
        Endswitch
Wend

the above code doesn't really works. can anyone tell me what I am doing wrong?

thanks and regards

Rishav

Hi,

personal helpcenter ....... ;-))

#Include <Misc.au3>
While 1
    if _IsPressed(70) Then
        MsgBox (0,"", "F1 pressed...")
        Exit
    EndIf
WEnd

;-))

Stefan

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

dont you ever take a rest? >_<

anyways thanks yet again. I just found another approach; using hotkey but I think I'll go with yours since it lets me use my wile do loop.

take a look at the current UI.

UPDATE: edited the script to use the misc.au3 function and it is much better now. :(

#cs ----------------------------------------------------------------------------
    
    AutoIt Version: 3.3.1.1 (beta)
    Author:         Rishav Sharan
    
    Script Function:
    GUI to create simple import test cases
    
#ce ----------------------------------------------------------------------------


;~ Includes
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <ComboConstants.au3>
#include <GuiDateTimePicker.au3>
#include <GuiTab.au3>
#include <Array.au3>
#include <File.au3>
#include <GuiTab.au3>
#include <GuiComboBox.au3>
#include <Misc.au3>


;~ GUI Backend data file. This is the temp ini file which saves all the data till a specific new file is created.
; This is to save the data in case of system failure.
; If we added the data directly to the grid, in case of accidental closure or power failure, the data will be lost.
$ProfilesINI = @ScriptDir & "\Profiles\NEW PROFILE.ini"
$GenericTempValue = "temp value"

; GUI
$MainGUI = GUICreate("Optima Rate Import Test Case Creator", 1100, 900, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP))
GUISetIcon(@SystemDir & "\mspaint.exe", 0)
GUISetBkColor(0xFFFFFF)

$x1 = 10
$y1 = 10



; DETAILS FIELDS
$TCName_label = GUICtrlCreateLabel("Test Case Name", $x1 + 10, $y1 + 23, 90, 15)
$TCName_field = GUICtrlCreateCombo("", $x1 + 110, $y1 + 23, 170, 20, $ES_UPPERCASE)

$TCPassNo_label = GUICtrlCreateLabel("Pass Number", $x1 + 320, $y1 + 23, 90, 15)
$TCPassNo_field = GUICtrlCreateInput("1", $x1 + 420, $y1 + 23, 170, 20, $ES_NUMBER)

$TestType_label = GUICtrlCreateLabel("Test Type", $x1 + 630, $y1 + 23, 90, 15)
$TestType_field = GUICtrlCreateCombo("", $x1 + 730, $y1 + 23, 170, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData($TestType_field, "Import Rates to Pending|Import Rates to Active|Edit Carrier Rates|Add Analysis Stage|Run SQL File|Run Win Batch File", "Import Rates to Pending")

; TC SUITE TABS
$Tab_TCSuite = _GUICtrlTab_Create($MainGUI, 0, 255, 1100, 650)
$Tab_TCSuite_handle = GUICtrlGetHandle($Tab_TCSuite)
_GUICtrlTab_InsertItem($Tab_TCSuite, 0, "NEW PROFILE")

; GET ALL INI FILES IN THE PROFILES FOLDER IN AN ARRAY
$IniFileList_array = _FileListToArray(@ScriptDir & "\Profiles\", "*.ini", 1)

; ADD TABS TO TAB BAR BASED OFF ON THE $IniFileList_array DATA
If @error = 0 Then
    For $d = 1 To $IniFileList_array[0]
        If $IniFileList_array[$d] <> "NEW PROFILE.ini" Then
            $Tab_Insert_Name = StringTrimRight($IniFileList_array[$d], 4)
            _GUICtrlTab_InsertItem($Tab_TCSuite, $d, $Tab_Insert_Name)
        EndIf
    Next
EndIf

; BUTTONS
$SaveBatch_button = GUICtrlCreateButton("Save to Grid", $x1 + 930, $y1, 150, 25)
$AddSeparator_button = GUICtrlCreateButton("Add Separator", $x1 + 930, $y1 + 30, 150, 25)
$AddAnal_button = GUICtrlCreateButton("Add Analysis Stage", $x1 + 930, $y1 + 60, 150, 25)
$RemFromGrid_button = GUICtrlCreateButton("Remove from Grid", $x1 + 930, $y1 + 90, 150, 25)
$MoveUp_button = GUICtrlCreateButton("Move up Item", $x1 + 930, $y1 + 120, 150, 25)
$MoveDown_button = GUICtrlCreateButton("Move Down Item", $x1 + 930, $y1 + 150, 150, 25)
$GridToFile_button = GUICtrlCreateButton("Save Grid to file", $x1 + 930, $y1 + 180, 150, 25)
$RunBatch_button = GUICtrlCreateButton("Run Batch", $x1 + 930, $y1 + 210, 150, 25, $BS_DEFPUSHBUTTON)

; DISABLE ALL EXTRA BUTTONS CURRENTLY
GUICtrlSetState($AddAnal_button, $GUI_DISABLE)
GUICtrlSetState($RunBatch_button, $GUI_DISABLE)
GUICtrlSetState($GridToFile_button, $GUI_DISABLE)

; LIST VIEW
$BatchList = GUICtrlCreateListView("", 5, 280, 1090, 620, BitOR(-1, $LVS_NOSORTHEADER, $WS_VSCROLL), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP))
$BatchList_handle = GUICtrlGetHandle($BatchList)
$Grid_serial_col = _GUICtrlListView_AddColumn($BatchList, "Serial No.")
$Grid_sequence_col = _GUICtrlListView_AddColumn($BatchList, "Sequence")
$Grid_Timestamp_col = _GUICtrlListView_AddColumn($BatchList, "Timestamp", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_Status_col = _GUICtrlListView_AddColumn($BatchList, "Test Case Status", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_OverallResult_col = _GUICtrlListView_AddColumn($BatchList, "Overall Result", $LVSCW_AUTOSIZE_USEHEADER)

$Grid_TCName_col = _GUICtrlListView_AddColumn($BatchList, "Test Case Name", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_PassNo_col = _GUICtrlListView_AddColumn($BatchList, "Pass No.", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_Carrier_col = _GUICtrlListView_AddColumn($BatchList, "Carrier Name", $LVSCW_AUTOSIZE_USEHEADER)

$Grid_TestType_col = _GUICtrlListView_AddColumn($BatchList, "Test Type", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_Details_col = _GUICtrlListView_AddColumn($BatchList, "Details", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_ServerDetails_col = _GUICtrlListView_AddColumn($BatchList, "Server Details", $LVSCW_AUTOSIZE_USEHEADER)

$Grid_AutoExpire_col = _GUICtrlListView_AddColumn($BatchList, "Autoexpire", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_IncrDate_col = _GUICtrlListView_AddColumn($BatchList, "Increase Date", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_DecrDate_col = _GUICtrlListView_AddColumn($BatchList, "Decrease Date", $LVSCW_AUTOSIZE_USEHEADER)

$Grid_DestName_col = _GUICtrlListView_AddColumn($BatchList, "Destination", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_DialCode_col = _GUICtrlListView_AddColumn($BatchList, "Dial Code", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_UidPass_col = _GUICtrlListView_AddColumn($BatchList, "UserId/Password", $LVSCW_AUTOSIZE_USEHEADER)

$Grid_Rate_col = _GUICtrlListView_AddColumn($BatchList, "Rate", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_EffectievDate_col = _GUICtrlListView_AddColumn($BatchList, "Effective Date", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_ExpiryDate_col = _GUICtrlListView_AddColumn($BatchList, "Expiry Date", $LVSCW_AUTOSIZE_USEHEADER)

$Grid_RSFile_col = _GUICtrlListView_AddColumn($BatchList, "Template File", $LVSCW_AUTOSIZE)
$Grid_RefFile_col = _GUICtrlListView_AddColumn($BatchList, "Reference File", $LVSCW_AUTOSIZE)

GUISetState()

;~ -----------------------------------------------------------------------------------------------------------------

$x1 = 5
$y1 = 8


; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS
$ControlGUI = GUICreate("", 920, 230, $x1, $y1, $WS_CHILD, -1, $MainGUI)
GUISetBkColor(0xFFFFFF)

GUICtrlCreateGroup("Please set the Test Case parameters", $x1, 0, 910, 220)
; DETAILS FIELDS
$CarrierName_label = GUICtrlCreateLabel("Carrier Name", $x1 + 10, $y1 + 50, 90, 15)
$CarrierName_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 50, 170, 20, $ES_UPPERCASE)

$RefDeffFileLocation_label = GUICtrlCreateLabel("Reference File", $x1 + 630, $y1 + 50, 90, 15)
$RefDeffFileLocation_field = GUICtrlCreateCombo("", $x1 + 730, $y1 + 50, 170, 20)

$ImportFileLocation_label = GUICtrlCreateLabel("Import File", $x1 + 10, $y1 + 80, 90, 15)
$ImportFileLocation_field = GUICtrlCreateCombo("", $x1 + 110, $y1 + 80, 170, 20)


; DATES
$IncrDate_label = GUICtrlCreateLabel("Increase Date", $x1 + 320, $y1 + 80, 90, 20)
$IncrDate_datefield = GUICtrlCreateDate("", $x1 + 420, $y1 + 80, 170, 20)
$IncrDate_handle = GUICtrlGetHandle($IncrDate_datefield)
_GUICtrlDTP_SetFormat($IncrDate_handle, "ddd, dd/MMM/yy")

$DecrDate_label = GUICtrlCreateLabel("Decrease Date", $x1 + 630, $y1 + 80, 90, 20)
$DecrDate_datefield = GUICtrlCreateDate("", $x1 + 730, $y1 + 80, 170, 20)
$DecrDate_handle = GUICtrlGetHandle($DecrDate_datefield)
_GUICtrlDTP_SetFormat($DecrDate_handle, "ddd, dd/MMM/yy")

GUISetState()


_RefreshGridData()

;~ -----------------------------------------------------------------------------------------------------------------

; Capture and execute all button clicks
While 1


    $msg = GUIGetMsg(1)

    Switch $msg[0]

        Case $TestType_field
            $TestType_data = ControlGetText("Optima Rate Import Test Case Creator", "Test Type", $TestType_field)

            Switch $TestType_data
                Case "Import Rates to Pending"
                    GUIDelete($ControlGUI)
                    ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS
                    $ControlGUI = GUICreate("", 920, 220, $x1, $y1, $WS_CHILD, -1, $MainGUI)
                    GUISetBkColor(0xFFFFFF)
                    GUICtrlCreateGroup("Please set the Test Case parameters", $x1, 0, 910, 220)

                    ; DETAILS FIELDS
                    $CarrierName_label = GUICtrlCreateLabel("Carrier Name", $x1 + 10, $y1 + 50, 90, 15)
                    $CarrierName_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 50, 170, 20, $ES_UPPERCASE)

                    $RefDeffFileLocation_label = GUICtrlCreateLabel("Reference File", $x1 + 630, $y1 + 50, 90, 15)
                    $RefDeffFileLocation_field = GUICtrlCreateCombo("", $x1 + 730, $y1 + 50, 170, 20)

                    $ImportFileLocation_label = GUICtrlCreateLabel("Import File", $x1 + 10, $y1 + 80, 90, 15)
                    $ImportFileLocation_field = GUICtrlCreateCombo("", $x1 + 110, $y1 + 80, 170, 20)


                    ; DATES
                    $IncrDate_label = GUICtrlCreateLabel("Increase Date", $x1 + 320, $y1 + 80, 90, 20)
                    $IncrDate_datefield = GUICtrlCreateDate("", $x1 + 420, $y1 + 80, 170, 20)
                    $IncrDate_handle = GUICtrlGetHandle($IncrDate_datefield)
                    _GUICtrlDTP_SetFormat($IncrDate_handle, "ddd, dd/MMM/yy")

                    $DecrDate_label = GUICtrlCreateLabel("Decrease Date", $x1 + 630, $y1 + 80, 90, 20)
                    $DecrDate_datefield = GUICtrlCreateDate("", $x1 + 730, $y1 + 80, 170, 20)
                    $DecrDate_handle = GUICtrlGetHandle($DecrDate_datefield)
                    _GUICtrlDTP_SetFormat($DecrDate_handle, "ddd, dd/MMM/yy")

                    GUISetState()

                Case "Import Rates to Active"
                    GUIDelete($ControlGUI)

                    ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS
                    $ControlGUI = GUICreate("", 920, 220, $x1, $y1, $WS_CHILD, -1, $MainGUI)
                    GUISetBkColor(0xFFFFFF)
                    GUICtrlCreateGroup("Please set the Test Case parameters", $x1, 0, 910, 220)

                    ; DETAILS FIELDS
                    $CarrierName_label = GUICtrlCreateLabel("Carrier Name", $x1 + 10, $y1 + 50, 90, 15)
                    $CarrierName_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 50, 170, 20, $ES_UPPERCASE)

                    $AdditionalDetails_label = GUICtrlCreateLabel("Additional Details", $x1 + 320, $y1 + 50, 90, 15)
                    $AdditionalDetails_field = GUICtrlCreateCombo("", $x1 + 420, $y1 + 50, 170, 20, $CBS_DROPDOWNLIST)
                    GUICtrlSetData($AdditionalDetails_field, "Don't Autoexpire Old Data|Autoexpire Old Data", "Don't Autoexpire Old Data")

                    $RefDeffFileLocation_label = GUICtrlCreateLabel("Reference File", $x1 + 630, $y1 + 50, 90, 15)
                    $RefDeffFileLocation_field = GUICtrlCreateCombo("", $x1 + 730, $y1 + 50, 170, 20)

                    $ImportFileLocation_label = GUICtrlCreateLabel("Import File", $x1 + 10, $y1 + 80, 90, 15)
                    $ImportFileLocation_field = GUICtrlCreateCombo("", $x1 + 110, $y1 + 80, 170, 20)

                    ; DATES
                    $IncrDate_label = GUICtrlCreateLabel("Increase Date", $x1 + 320, $y1 + 80, 90, 20)
                    $IncrDate_datefield = GUICtrlCreateDate("", $x1 + 420, $y1 + 80, 170, 20)
                    $IncrDate_handle = GUICtrlGetHandle($IncrDate_datefield)
                    _GUICtrlDTP_SetFormat($IncrDate_handle, "ddd, dd/MMM/yy")

                    $DecrDate_label = GUICtrlCreateLabel("Decrease Date", $x1 + 630, $y1 + 80, 90, 20)
                    $DecrDate_datefield = GUICtrlCreateDate("", $x1 + 730, $y1 + 80, 170, 20)
                    $DecrDate_handle = GUICtrlGetHandle($DecrDate_datefield)
                    _GUICtrlDTP_SetFormat($DecrDate_handle, "ddd, dd/MMM/yy")

                    GUISetState()

                Case "Edit Carrier Rates"
                    GUIDelete($ControlGUI)

                    ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS
                    $ControlGUI = GUICreate("", 920, 220, $x1, $y1, $WS_CHILD, -1, $MainGUI)
                    GUISetBkColor(0xFFFFFF)
                    GUICtrlCreateGroup("Please set the Test Case parameters", $x1, 0, 910, 220)

                    ; DETAILS FIELDS
                    $CarrierName_label = GUICtrlCreateLabel("Carrier Name", $x1 + 10, $y1 + 50, 90, 15)
                    $CarrierName_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 50, 170, 20, $ES_UPPERCASE)

                    $AdditionalDetails_label = GUICtrlCreateLabel("Additional Details", $x1 + 320, $y1 + 50, 90, 15)
                    $AdditionalDetails_field = GUICtrlCreateCombo("", $x1 + 420, $y1 + 50, 170, 20, $CBS_DROPDOWNLIST)
                    GUICtrlSetData($AdditionalDetails_field, "Refresh Grid|Edit Entry|Delete Entry|Clear All", "Refresh Grid")

                    $RefDeffFileLocation_label = GUICtrlCreateLabel("Reference File", $x1 + 630, $y1 + 50, 90, 15)
                    $RefDeffFileLocation_field = GUICtrlCreateCombo("", $x1 + 730, $y1 + 50, 170, 20)

                    ; DETAILS FIELDS
                    $Destnination_label = GUICtrlCreateLabel("Destination Name", $x1 + 10, $y1 + 110, 90, 15)
                    $Destnination_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 110, 170, 20)

                    $DialCode_label = GUICtrlCreateLabel("Dial Code", $x1 + 320, $y1 + 110, 90, 15)
                    $DialCode_field = GUICtrlCreateInput("", $x1 + 420, $y1 + 110, 170, 20, $ES_NUMBER)

                    $Rate_label = GUICtrlCreateLabel("Rate", $x1 + 630, $y1 + 110, 90, 15)
                    $Rate_field = GUICtrlCreateInput("", $x1 + 730, $y1 + 110, 170, 20, $ES_NUMBER)

;~ CHECKBOXED DATE
                    $tDate = 0

                    $EffDate_label = GUICtrlCreateLabel("Use Effective Date", $x1 + 320, $y1 + 140, 90, 20)
                    $EffDate_datefield = GUICtrlCreateDate("", $x1 + 420, $y1 + 140, 170, 20, BitOR($DTS_SHOWNONE, $DTS_LONGDATEFORMAT))
                    $EffDate_handle = GUICtrlGetHandle($EffDate_datefield)
                    _GUICtrlDTP_SetFormat($EffDate_handle, "ddd, dd/MMM/yy")
                    _GUICtrlDTP_SetSystemTimeEx($EffDate_handle, $tDate, True)

                    $ExpDate_label = GUICtrlCreateLabel("Use Expiry Date", $x1 + 630, $y1 + 140, 90, 20)
                    $ExpDate_datefield = GUICtrlCreateDate("", $x1 + 730, $y1 + 140, 170, 20, BitOR($DTS_SHOWNONE, $DTS_LONGDATEFORMAT))
                    $ExpDate_handle = GUICtrlGetHandle($ExpDate_datefield)
                    _GUICtrlDTP_SetFormat($ExpDate_handle, "ddd, dd/MMM/yy")
                    _GUICtrlDTP_SetSystemTimeEx($ExpDate_handle, $tDate, True)

                    GUISetState()
                    MsgBox(0, "How did you end up here?", "Nothing in here. Go away.")

                    ;RESET THE TEST TYPE TO INITIAL CHOICE
                    ControlSend("Optima Rate Import Test Case Creator", "Test Type", $TestType_field, "i")

                Case "Add Analysis Stage"
                    GUIDelete($ControlGUI)

                    ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS
                    $ControlGUI = GUICreate("", 920, 220, $x1, $y1, $WS_CHILD, -1, $MainGUI)
                    GUISetBkColor(0xFFFFFF)
                    GUICtrlCreateGroup("Please set the Test Case parameters", $x1, 0, 910, 220)

                    $AdditionalDetails_label = GUICtrlCreateLabel("Additional Details", $x1 + 320, $y1 + 50, 90, 15)
                    $AdditionalDetails_field = GUICtrlCreateCombo("", $x1 + 420, $y1 + 50, 170, 20, $CBS_DROPDOWNLIST)
                    GUICtrlSetData($AdditionalDetails_field, "Run All Scripts|Run Script A001|Run Script A002|Run Script A003|Run Script A004|", "Run All Scripts")

                    GUISetState()


                Case "Run SQL File"
                    GUIDelete($ControlGUI)

                    ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS
                    $ControlGUI = GUICreate("", 920, 220, $x1, $y1, $WS_CHILD, -1, $MainGUI)
                    GUISetBkColor(0xFFFFFF)
                    GUICtrlCreateGroup("Please set the Test Case parameters", $x1, 0, 910, 220)

                    $ServerDetails_label = GUICtrlCreateLabel("Server Details Name", $x1 + 10, $y1 + 170, 90, 15)
                    $ServerDetails_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 170, 170, 20)

                    $UidPass_label = GUICtrlCreateLabel("User Id/Password", $x1 + 320, $y1 + 170, 90, 15)
                    $UidPass_field = GUICtrlCreateInput("", $x1 + 420, $y1 + 170, 170, 20)

                    GUISetState()
                    MsgBox(0, "How did you end up here?", "Nothing in here. Go away.")

                    ;RESET THE TEST TYPE TO INITIAL CHOICE
                    ControlSend("Optima Rate Import Test Case Creator", "Test Type", $TestType_field, "i")

                Case "Run Win Batch File"
                    GUIDelete($ControlGUI)

                    ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS
                    $ControlGUI = GUICreate("", 920, 220, $x1, $y1, $WS_CHILD, -1, $MainGUI)
                    GUISetBkColor(0xFFFFFF)
                    GUICtrlCreateGroup("Please set the Test Case parameters", $x1, 0, 910, 220)

                    $ServerDetails_label = GUICtrlCreateLabel("Server Details Name", $x1 + 10, $y1 + 170, 90, 15)
                    $ServerDetails_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 170, 170, 20)

                    $UidPass_label = GUICtrlCreateLabel("User Id/Password", $x1 + 320, $y1 + 170, 90, 15)
                    $UidPass_field = GUICtrlCreateInput("", $x1 + 420, $y1 + 170, 170, 20)

                    GUISetState()
                    MsgBox(0, "How did you end up here?", "Nothing in here. Go away.")

                    ;RESET THE TEST TYPE TO INITIAL CHOICE
                    ControlSend("Optima Rate Import Test Case Creator", "Test Type", $TestType_field, "i")


            EndSwitch

;~ -----------------------------------------------------------------------------------------------------------------

        Case $GUI_EVENT_CLOSE
            SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav")
            GUIDelete()
            Exit

        Case $SaveBatch_button
            SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav")

            $Grid_listdata_sections = IniReadSectionNames($ProfilesINI)
            If @error = 1 Then
                $SectionNumber_data = 1
            Else
                $SectionNumber_data = $Grid_listdata_sections[0] + 1
            EndIf
            IniWriteSection($ProfilesINI, $SectionNumber_data, "")

            $Timestamp_data = @MDAY & @MON & @YEAR & @HOUR & @MIN & @SEC
            IniWrite($ProfilesINI, $SectionNumber_data, "TIMESTAMP", $Timestamp_data)

            $TestCaseStatus_data = ""
            IniWrite($ProfilesINI, $SectionNumber_data, "TEST CASE STATUS", $TestCaseStatus_data)

            $OverallResult_data = "Queued"
            IniWrite($ProfilesINI, $SectionNumber_data, "OVERALL RESULT", $OverallResult_data)

            $TCName_data = ControlGetText("Optima Rate Import Test Case Creator", "Test Case Name", $TCName_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "TEST CASE NAME", $TCName_data)

            $TCPassNo_data = ControlGetText("Optima Rate Import Test Case Creator", "Pass Number", $TCPassNo_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "PASS NUMBER", $TCPassNo_data)

            $CarrierName_data = ControlGetText("Optima Rate Import Test Case Creator", "Carrier Name", $CarrierName_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "CARRIER NAME", $CarrierName_data)

            $TestType_data = ControlGetText("Optima Rate Import Test Case Creator", "Test Type", $TestType_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "TEST TYPE", $TestType_data)

            $AdditionalDetails_data = ControlGetText("Optima Rate Import Test Case Creator", "Additional Details", $AdditionalDetails_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "DETAILS", $AdditionalDetails_data)

            $ServerDetails_data = ControlGetText("Optima Rate Import Test Case Creator", "Server Details Name", $ServerDetails_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "Server Details", $ServerDetails_data)

            $IncrDate_data = GUICtrlRead($IncrDate_datefield)
            IniWrite($ProfilesINI, $SectionNumber_data, "INCREASE DATE", $IncrDate_data)

            $DecrDate_data = GUICtrlRead($DecrDate_datefield)
            IniWrite($ProfilesINI, $SectionNumber_data, "DECREASE DATE", $DecrDate_data)

            $Destnination_data = ControlGetText("Optima Rate Import Test Case Creator", "Destination Nam", $Destnination_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "DESTINATION", $Destnination_data)

            $DialCode_data = ControlGetText("Optima Rate Import Test Case Creator", "Rate", $DialCode_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "DIAL CODE", $DialCode_data)

            $UidPass_data = ControlGetText("Optima Rate Import Test Case Creator", "User Id/Password", $UidPass_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "USERID AND PASSWORD", $UidPass_data)

            $Rate_data = ControlGetText("Optima Rate Import Test Case Creator", "Rate", $Rate_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "RATE", $Rate_data)

            $EffDate_data = GUICtrlRead($EffDate_datefield)
            IniWrite($ProfilesINI, $SectionNumber_data, "EFFECTIVE DATE", $EffDate_data)

            $ExpDate_data = GUICtrlRead($ExpDate_datefield)
            IniWrite($ProfilesINI, $SectionNumber_data, "EXPIRY DATE", $ExpDate_data)

            $ImportFileLocation_data = ControlGetText("Optima Rate Import Test Case Creator", "Import File", $ImportFileLocation_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "IMPORT FILE", $ImportFileLocation_data)

            $RefDeffFileLocation_data = ControlGetText("Optima Rate Import Test Case Creator", "Reference File", $RefDeffFileLocation_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "REFERENCE FILE", $RefDeffFileLocation_data)

            _RefreshGridData()

        Case $RemFromGrid_button
            SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav")
            $SelectedRow = _GUICtrlListView_GetSelectedIndices($BatchList_handle) + 1
            If $SelectedRow > 1 Then
                $Grid_listdata_sections = IniReadSectionNames($ProfilesINI)
                $Ini_Section_delete = $Grid_listdata_sections[$SelectedRow]
                IniDelete($ProfilesINI, $Ini_Section_delete)
                For $c = $Grid_listdata_sections[$SelectedRow] To $Grid_listdata_sections[0]
                    IniRenameSection($ProfilesINI, $Grid_listdata_sections[$c], $Grid_listdata_sections[$c] - 1)
                Next
            EndIf
            _RefreshGridData()


        Case $MoveUp_button
            $SelectedRow = _GUICtrlListView_GetSelectedIndices($BatchList_handle) + 1
            $Grid_listdata_sections = IniReadSectionNames($ProfilesINI)
            _ArraySort($Grid_listdata_sections, 0, 1)
            If $SelectedRow > 1 Then
                $Selected_section = $Grid_listdata_sections[$SelectedRow]
                $Above_section = $Grid_listdata_sections[$SelectedRow - 1]

                $temp = 9999999
                IniRenameSection($ProfilesINI, $Selected_section, $temp)
                IniRenameSection($ProfilesINI, $Above_section, $Grid_listdata_sections[$SelectedRow])
                IniRenameSection($ProfilesINI, $temp, $Grid_listdata_sections[$SelectedRow - 1])
            EndIf

            _RefreshGridData()

        Case $MoveDown_button
            SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav")
            $SelectedRow = _GUICtrlListView_GetSelectedIndices($BatchList_handle) + 1
            $Grid_listdata_sections = IniReadSectionNames($ProfilesINI)
            _ArraySort($Grid_listdata_sections, 0, 1)
            If $SelectedRow < $Grid_listdata_sections[0] Then
                $Selected_section = $Grid_listdata_sections[$SelectedRow]
                $Below_section = $Grid_listdata_sections[$SelectedRow + 1]

                MsgBox(0, $Selected_section, $Below_section)
                $temp = "xxx"
                IniRenameSection($ProfilesINI, $Selected_section, $temp)
                IniRenameSection($ProfilesINI, $Below_section, $Selected_section)
                IniRenameSection($ProfilesINI, $temp, $Below_section)
            EndIf

            _RefreshGridData()

        Case $AddSeparator_button
            SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav")

            $Grid_listdata_sections = IniReadSectionNames($ProfilesINI)
            If @error = 1 Then
                $SectionNumber_data = 1
            Else
                $SectionNumber_data = $Grid_listdata_sections[0] + 1
            EndIf
            IniWriteSection($ProfilesINI, $SectionNumber_data, "")

            $Timestamp_data = @MDAY & @MON & @YEAR & @HOUR & @MIN & @SEC
            IniWrite($ProfilesINI, $SectionNumber_data, "TIMESTAMP", $Timestamp_data)

            $TestCaseStatus_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "TEST CASE STATUS", $TestCaseStatus_data)

            $OverallResult_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "OVERALL RESULT", $OverallResult_data)

            $TCName_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "TEST CASE NAME", $TCName_data)

            $TCPassNo_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "PASS NUMBER", $TCPassNo_data)

            $CarrierName_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "CARRIER NAME", $CarrierName_data)

            $TestType_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "TEST TYPE", $TestType_data)

            $AdditionalDetails_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "DETAILS", $AdditionalDetails_data)

            $ServerDetails_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "Server Details", $ServerDetails_data)

            $AutoExpire_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "AUTOEXPIRE", $AutoExpire_data)

            $IncrDate_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "INCREASE DATE", $IncrDate_data)

            $DecrDate_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "DECREASE DATE", $DecrDate_data)

            $Destnination_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "DESTINATION", $Destnination_data)

            $DialCode_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "DIAL CODE", $DialCode_data)

            $UidPass_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "USERID AND PASSWORD", $UidPass_data)

            $Rate_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "RATE", $Rate_data)

            $EffDate_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "EFFECTIVE DATE", $EffDate_data)

            $ExpDate_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "EXPIRY DATE", $ExpDate_data)

            $ImportFileLocation_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "IMPORT FILE", $ImportFileLocation_data)

            $RefDeffFileLocation_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "REFERENCE FILE", $RefDeffFileLocation_data)

            _RefreshGridData()

;~ -----------------------------------------------------------------------------------------------------------------

        Case $msg = $Tab_TCSuite

            $current = _GUICtrlTab_GetCurSel($Tab_TCSuite)
            $Tab_Name = _GUICtrlTab_GetItemText($Tab_TCSuite, $current)

            $ProfilesINI = @ScriptDir & "\Profiles\" & $Tab_Name & ".ini"
            ; This here is a temp solution to stop the contineous refrsh problem.
            If $current <> $GenericTempValue Then
                _RefreshGridData()
            EndIf
            $GenericTempValue = $current

    EndSwitch

;~ -----------------------------------------------------------------------------------------------------------------

    ; CREATE THE ABOUT SCREEN WHICH WILL BE LAUCHED BY USING F1
    If _IsPressed(70) Then
        $AboutScreen_GUI = GUICreate("About Automata v0.1 alpha", 500, 300, -1, -1)
        GUISetState()
    EndIf

WEnd

;~ -----------------------------------------------------------------------------------------------------------------

Func _RefreshGridData()
    $Grid_listdata_sections = IniReadSectionNames($ProfilesINI)
    If @error Then
        _GUICtrlListView_DeleteAllItems($BatchList_handle)
    ElseIf $Grid_listdata_sections[0] > 0 Then
        _GUICtrlListView_BeginUpdate($BatchList_handle)
        _GUICtrlListView_DeleteAllItems($BatchList_handle)

        For $a = 1 To $Grid_listdata_sections[0]

;~          _ArrayDisplay($Grid_listdata_sections)
            _ArraySort($Grid_listdata_sections, 0, 1)
;~          _ArrayDisplay($Grid_listdata_sections)
            $Grid_All_listdata = IniReadSection($ProfilesINI, $Grid_listdata_sections[$a])
            If Not @error Then
                If $Grid_All_listdata[0][0] > 0 Then
                    _GUICtrlListView_AddItem($BatchList_handle, $a)
                    _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, $Grid_listdata_sections[$a], 1)
                    For $b = 2 To $Grid_All_listdata[0][0]
                        _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, $Grid_All_listdata[$b][1], $b + 1)
                    Next
                EndIf
            EndIf
        Next
        For $a = 0 To _GUICtrlListView_GetColumnCount($BatchList_handle)
            _GUICtrlListView_SetColumnWidth($BatchList_handle, $a, $LVSCW_AUTOSIZE_USEHEADER)
        Next
        _GUICtrlListView_EndUpdate($BatchList_handle)
    EndIf
EndFunc   ;==>_RefreshGridData
Edited by Rishav

Share this post


Link to post
Share on other sites

Hi,

Code correction:

#Include <Misc.au3>
$dll = DllOpen("user32.dll")
While 1
    if _IsPressed("70", $dll) Then
        MsgBox (0,"", "F1 pressed...")
        ExitLoop
    EndIf
WEnd
DllClose($dll)

You have to test it, because this code starts a second autoit trayicon on my pc. This tray has to close by useraction.

If i use the example of _ispressed everything is ok (end key). I think it has to do with the F1 key, because this is starting autoit help as well?!?

;-))

Stefan

Share this post


Link to post
Share on other sites

Thanks Brett but pretty much everything in there went over my head. sorry. 8/

Have another question. in my script when I press F1, a UI opens. But when i click close on this pop up UI, both it and my main GUI closes. how come?

#cs ----------------------------------------------------------------------------
    
    AutoIt Version: 3.3.1.1 (beta)
    Author:         Rishav Sharan
    
    Script Function:
    GUI to create simple import test cases
    
#ce ----------------------------------------------------------------------------


;~ Includes
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <ComboConstants.au3>
#include <GuiDateTimePicker.au3>
#include <GuiTab.au3>
#include <Array.au3>
#include <File.au3>
#include <GuiTab.au3>
#include <GuiComboBox.au3>
#include <Misc.au3>


;~ GUI Backend data file. This is the temp ini file which saves all the data till a specific new file is created.
; This is to save the data in case of system failure.
; If we added the data directly to the grid, in case of accidental closure or power failure, the data will be lost.
$ProfilesINI = @ScriptDir & "\Profiles\NEW PROFILE.ini"
$GenericTempValue = "temp value"

$User32dll = DllOpen("user32.dll")


; GUI
$MainGUI = GUICreate("Optima Rate Import Test Case Creator", 1100, 900, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_GROUP))
GUISetIcon(@SystemDir & "\mspaint.exe", 0)
GUISetBkColor(0xFFFFFF)

$x1 = 10
$y1 = 10



; DETAILS FIELDS
$TCName_label = GUICtrlCreateLabel("Test Case Name", $x1 + 10, $y1 + 23, 90, 15)
$TCName_field = GUICtrlCreateCombo("", $x1 + 110, $y1 + 23, 170, 20, $ES_UPPERCASE)

$TCPassNo_label = GUICtrlCreateLabel("Pass Number", $x1 + 320, $y1 + 23, 90, 15)
$TCPassNo_field = GUICtrlCreateInput("1", $x1 + 420, $y1 + 23, 170, 20, $ES_NUMBER)

$TestType_label = GUICtrlCreateLabel("Test Type", $x1 + 630, $y1 + 23, 90, 15)
$TestType_field = GUICtrlCreateCombo("", $x1 + 730, $y1 + 23, 170, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData($TestType_field, "Import Rates to Pending|Import Rates to Active|Edit Carrier Rates|Add Analysis Stage|Run SQL File|Run Win Batch File", "Import Rates to Pending")

; TC SUITE TABS
$Tab_TCSuite = _GUICtrlTab_Create($MainGUI, 0, 255, 1100, 650)
$Tab_TCSuite_handle = GUICtrlGetHandle($Tab_TCSuite)
_GUICtrlTab_InsertItem($Tab_TCSuite, 0, "NEW PROFILE")

; GET ALL INI FILES IN THE PROFILES FOLDER IN AN ARRAY
$IniFileList_array = _FileListToArray(@ScriptDir & "\Profiles\", "*.ini", 1)

; ADD TABS TO TAB BAR BASED OFF ON THE $IniFileList_array DATA
If @error = 0 Then
    For $d = 1 To $IniFileList_array[0]
        If $IniFileList_array[$d] <> "NEW PROFILE.ini" Then
            $Tab_Insert_Name = StringTrimRight($IniFileList_array[$d], 4)
            _GUICtrlTab_InsertItem($Tab_TCSuite, $d, $Tab_Insert_Name)
        EndIf
    Next
EndIf

; BUTTONS
$SaveBatch_button = GUICtrlCreateButton("Save to Grid", $x1 + 930, $y1, 150, 25)
$AddSeparator_button = GUICtrlCreateButton("Add Separator", $x1 + 930, $y1 + 30, 150, 25)
$AddAnal_button = GUICtrlCreateButton("Add Analysis Stage", $x1 + 930, $y1 + 60, 150, 25)
$RemFromGrid_button = GUICtrlCreateButton("Remove from Grid", $x1 + 930, $y1 + 90, 150, 25)
$MoveUp_button = GUICtrlCreateButton("Move up Item", $x1 + 930, $y1 + 120, 150, 25)
$MoveDown_button = GUICtrlCreateButton("Move Down Item", $x1 + 930, $y1 + 150, 150, 25)
$GridToFile_button = GUICtrlCreateButton("Save Grid to file", $x1 + 930, $y1 + 180, 150, 25)
$RunBatch_button = GUICtrlCreateButton("Run Batch", $x1 + 930, $y1 + 210, 150, 25, $BS_DEFPUSHBUTTON)

; DISABLE ALL EXTRA BUTTONS CURRENTLY
GUICtrlSetState($AddAnal_button, $GUI_DISABLE)
GUICtrlSetState($RunBatch_button, $GUI_DISABLE)
GUICtrlSetState($GridToFile_button, $GUI_DISABLE)

; LIST VIEW
$BatchList = GUICtrlCreateListView("", 5, 280, 1090, 620, BitOR(-1, $LVS_NOSORTHEADER, $WS_VSCROLL), BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_HEADERDRAGDROP))
$BatchList_handle = GUICtrlGetHandle($BatchList)
$Grid_serial_col = _GUICtrlListView_AddColumn($BatchList, "Serial No.")
$Grid_sequence_col = _GUICtrlListView_AddColumn($BatchList, "Sequence")
$Grid_Timestamp_col = _GUICtrlListView_AddColumn($BatchList, "Timestamp", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_Status_col = _GUICtrlListView_AddColumn($BatchList, "Test Case Status", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_OverallResult_col = _GUICtrlListView_AddColumn($BatchList, "Overall Result", $LVSCW_AUTOSIZE_USEHEADER)

$Grid_TCName_col = _GUICtrlListView_AddColumn($BatchList, "Test Case Name", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_PassNo_col = _GUICtrlListView_AddColumn($BatchList, "Pass No.", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_Carrier_col = _GUICtrlListView_AddColumn($BatchList, "Carrier Name", $LVSCW_AUTOSIZE_USEHEADER)

$Grid_TestType_col = _GUICtrlListView_AddColumn($BatchList, "Test Type", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_Details_col = _GUICtrlListView_AddColumn($BatchList, "Details", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_ServerDetails_col = _GUICtrlListView_AddColumn($BatchList, "Server Details", $LVSCW_AUTOSIZE_USEHEADER)

$Grid_AutoExpire_col = _GUICtrlListView_AddColumn($BatchList, "Autoexpire", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_IncrDate_col = _GUICtrlListView_AddColumn($BatchList, "Increase Date", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_DecrDate_col = _GUICtrlListView_AddColumn($BatchList, "Decrease Date", $LVSCW_AUTOSIZE_USEHEADER)

$Grid_DestName_col = _GUICtrlListView_AddColumn($BatchList, "Destination", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_DialCode_col = _GUICtrlListView_AddColumn($BatchList, "Dial Code", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_UidPass_col = _GUICtrlListView_AddColumn($BatchList, "UserId/Password", $LVSCW_AUTOSIZE_USEHEADER)

$Grid_Rate_col = _GUICtrlListView_AddColumn($BatchList, "Rate", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_EffectievDate_col = _GUICtrlListView_AddColumn($BatchList, "Effective Date", $LVSCW_AUTOSIZE_USEHEADER)
$Grid_ExpiryDate_col = _GUICtrlListView_AddColumn($BatchList, "Expiry Date", $LVSCW_AUTOSIZE_USEHEADER)

$Grid_RSFile_col = _GUICtrlListView_AddColumn($BatchList, "Template File", $LVSCW_AUTOSIZE)
$Grid_RefFile_col = _GUICtrlListView_AddColumn($BatchList, "Reference File", $LVSCW_AUTOSIZE)

GUISetState()

;~ -----------------------------------------------------------------------------------------------------------------

$x1 = 5
$y1 = 8


; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS
$ControlGUI = GUICreate("", 920, 230, $x1, $y1, $WS_CHILD, -1, $MainGUI)
GUISetBkColor(0xFFFFFF)

GUICtrlCreateGroup("Please set the Test Case parameters", $x1, 0, 910, 220)
; DETAILS FIELDS
$CarrierName_label = GUICtrlCreateLabel("Carrier Name", $x1 + 10, $y1 + 50, 90, 15)
$CarrierName_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 50, 170, 20, $ES_UPPERCASE)

$RefDeffFileLocation_label = GUICtrlCreateLabel("Reference File", $x1 + 630, $y1 + 50, 90, 15)
$RefDeffFileLocation_field = GUICtrlCreateCombo("", $x1 + 730, $y1 + 50, 170, 20)

$ImportFileLocation_label = GUICtrlCreateLabel("Import File", $x1 + 10, $y1 + 80, 90, 15)
$ImportFileLocation_field = GUICtrlCreateCombo("", $x1 + 110, $y1 + 80, 170, 20)


; DATES
$IncrDate_label = GUICtrlCreateLabel("Increase Date", $x1 + 320, $y1 + 80, 90, 20)
$IncrDate_datefield = GUICtrlCreateDate("", $x1 + 420, $y1 + 80, 170, 20)
$IncrDate_handle = GUICtrlGetHandle($IncrDate_datefield)
_GUICtrlDTP_SetFormat($IncrDate_handle, "ddd, dd/MMM/yy")

$DecrDate_label = GUICtrlCreateLabel("Decrease Date", $x1 + 630, $y1 + 80, 90, 20)
$DecrDate_datefield = GUICtrlCreateDate("", $x1 + 730, $y1 + 80, 170, 20)
$DecrDate_handle = GUICtrlGetHandle($DecrDate_datefield)
_GUICtrlDTP_SetFormat($DecrDate_handle, "ddd, dd/MMM/yy")

GUISetState()


_RefreshGridData()

;~ -----------------------------------------------------------------------------------------------------------------

; Capture and execute all button clicks
While 1


    $msg = GUIGetMsg(1)

    Switch $msg[0]

        Case $TestType_field
            $TestType_data = ControlGetText("Optima Rate Import Test Case Creator", "Test Type", $TestType_field)

            Switch $TestType_data
                Case "Import Rates to Pending"
                    GUIDelete($ControlGUI)
                    ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS
                    $ControlGUI = GUICreate("", 920, 220, $x1, $y1, $WS_CHILD, -1, $MainGUI)
                    GUISetBkColor(0xFFFFFF)
                    GUICtrlCreateGroup("Please set the Test Case parameters", $x1, 0, 910, 220)

                    ; DETAILS FIELDS
                    $CarrierName_label = GUICtrlCreateLabel("Carrier Name", $x1 + 10, $y1 + 50, 90, 15)
                    $CarrierName_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 50, 170, 20, $ES_UPPERCASE)

                    $RefDeffFileLocation_label = GUICtrlCreateLabel("Reference File", $x1 + 630, $y1 + 50, 90, 15)
                    $RefDeffFileLocation_field = GUICtrlCreateCombo("", $x1 + 730, $y1 + 50, 170, 20)

                    $ImportFileLocation_label = GUICtrlCreateLabel("Import File", $x1 + 10, $y1 + 80, 90, 15)
                    $ImportFileLocation_field = GUICtrlCreateCombo("", $x1 + 110, $y1 + 80, 170, 20)


                    ; DATES
                    $IncrDate_label = GUICtrlCreateLabel("Increase Date", $x1 + 320, $y1 + 80, 90, 20)
                    $IncrDate_datefield = GUICtrlCreateDate("", $x1 + 420, $y1 + 80, 170, 20)
                    $IncrDate_handle = GUICtrlGetHandle($IncrDate_datefield)
                    _GUICtrlDTP_SetFormat($IncrDate_handle, "ddd, dd/MMM/yy")

                    $DecrDate_label = GUICtrlCreateLabel("Decrease Date", $x1 + 630, $y1 + 80, 90, 20)
                    $DecrDate_datefield = GUICtrlCreateDate("", $x1 + 730, $y1 + 80, 170, 20)
                    $DecrDate_handle = GUICtrlGetHandle($DecrDate_datefield)
                    _GUICtrlDTP_SetFormat($DecrDate_handle, "ddd, dd/MMM/yy")

                    GUISetState()

                Case "Import Rates to Active"
                    GUIDelete($ControlGUI)

                    ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS
                    $ControlGUI = GUICreate("", 920, 220, $x1, $y1, $WS_CHILD, -1, $MainGUI)
                    GUISetBkColor(0xFFFFFF)
                    GUICtrlCreateGroup("Please set the Test Case parameters", $x1, 0, 910, 220)

                    ; DETAILS FIELDS
                    $CarrierName_label = GUICtrlCreateLabel("Carrier Name", $x1 + 10, $y1 + 50, 90, 15)
                    $CarrierName_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 50, 170, 20, $ES_UPPERCASE)

                    $AdditionalDetails_label = GUICtrlCreateLabel("Additional Details", $x1 + 320, $y1 + 50, 90, 15)
                    $AdditionalDetails_field = GUICtrlCreateCombo("", $x1 + 420, $y1 + 50, 170, 20, $CBS_DROPDOWNLIST)
                    GUICtrlSetData($AdditionalDetails_field, "Don't Autoexpire Old Data|Autoexpire Old Data", "Don't Autoexpire Old Data")

                    $RefDeffFileLocation_label = GUICtrlCreateLabel("Reference File", $x1 + 630, $y1 + 50, 90, 15)
                    $RefDeffFileLocation_field = GUICtrlCreateCombo("", $x1 + 730, $y1 + 50, 170, 20)

                    $ImportFileLocation_label = GUICtrlCreateLabel("Import File", $x1 + 10, $y1 + 80, 90, 15)
                    $ImportFileLocation_field = GUICtrlCreateCombo("", $x1 + 110, $y1 + 80, 170, 20)

                    ; DATES
                    $IncrDate_label = GUICtrlCreateLabel("Increase Date", $x1 + 320, $y1 + 80, 90, 20)
                    $IncrDate_datefield = GUICtrlCreateDate("", $x1 + 420, $y1 + 80, 170, 20)
                    $IncrDate_handle = GUICtrlGetHandle($IncrDate_datefield)
                    _GUICtrlDTP_SetFormat($IncrDate_handle, "ddd, dd/MMM/yy")

                    $DecrDate_label = GUICtrlCreateLabel("Decrease Date", $x1 + 630, $y1 + 80, 90, 20)
                    $DecrDate_datefield = GUICtrlCreateDate("", $x1 + 730, $y1 + 80, 170, 20)
                    $DecrDate_handle = GUICtrlGetHandle($DecrDate_datefield)
                    _GUICtrlDTP_SetFormat($DecrDate_handle, "ddd, dd/MMM/yy")

                    GUISetState()

                Case "Edit Carrier Rates"
                    GUIDelete($ControlGUI)

                    ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS
                    $ControlGUI = GUICreate("", 920, 220, $x1, $y1, $WS_CHILD, -1, $MainGUI)
                    GUISetBkColor(0xFFFFFF)
                    GUICtrlCreateGroup("Please set the Test Case parameters", $x1, 0, 910, 220)

                    ; DETAILS FIELDS
                    $CarrierName_label = GUICtrlCreateLabel("Carrier Name", $x1 + 10, $y1 + 50, 90, 15)
                    $CarrierName_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 50, 170, 20, $ES_UPPERCASE)

                    $AdditionalDetails_label = GUICtrlCreateLabel("Additional Details", $x1 + 320, $y1 + 50, 90, 15)
                    $AdditionalDetails_field = GUICtrlCreateCombo("", $x1 + 420, $y1 + 50, 170, 20, $CBS_DROPDOWNLIST)
                    GUICtrlSetData($AdditionalDetails_field, "Refresh Grid|Edit Entry|Delete Entry|Clear All", "Refresh Grid")

                    $RefDeffFileLocation_label = GUICtrlCreateLabel("Reference File", $x1 + 630, $y1 + 50, 90, 15)
                    $RefDeffFileLocation_field = GUICtrlCreateCombo("", $x1 + 730, $y1 + 50, 170, 20)

                    ; DETAILS FIELDS
                    $Destnination_label = GUICtrlCreateLabel("Destination Name", $x1 + 10, $y1 + 110, 90, 15)
                    $Destnination_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 110, 170, 20)

                    $DialCode_label = GUICtrlCreateLabel("Dial Code", $x1 + 320, $y1 + 110, 90, 15)
                    $DialCode_field = GUICtrlCreateInput("", $x1 + 420, $y1 + 110, 170, 20, $ES_NUMBER)

                    $Rate_label = GUICtrlCreateLabel("Rate", $x1 + 630, $y1 + 110, 90, 15)
                    $Rate_field = GUICtrlCreateInput("", $x1 + 730, $y1 + 110, 170, 20, $ES_NUMBER)

;~ CHECKBOXED DATE
                    $tDate = 0

                    $EffDate_label = GUICtrlCreateLabel("Use Effective Date", $x1 + 320, $y1 + 140, 90, 20)
                    $EffDate_datefield = GUICtrlCreateDate("", $x1 + 420, $y1 + 140, 170, 20, BitOR($DTS_SHOWNONE, $DTS_LONGDATEFORMAT))
                    $EffDate_handle = GUICtrlGetHandle($EffDate_datefield)
                    _GUICtrlDTP_SetFormat($EffDate_handle, "ddd, dd/MMM/yy")
                    _GUICtrlDTP_SetSystemTimeEx($EffDate_handle, $tDate, True)

                    $ExpDate_label = GUICtrlCreateLabel("Use Expiry Date", $x1 + 630, $y1 + 140, 90, 20)
                    $ExpDate_datefield = GUICtrlCreateDate("", $x1 + 730, $y1 + 140, 170, 20, BitOR($DTS_SHOWNONE, $DTS_LONGDATEFORMAT))
                    $ExpDate_handle = GUICtrlGetHandle($ExpDate_datefield)
                    _GUICtrlDTP_SetFormat($ExpDate_handle, "ddd, dd/MMM/yy")
                    _GUICtrlDTP_SetSystemTimeEx($ExpDate_handle, $tDate, True)

                    GUISetState()
                    MsgBox(0, "How did you end up here?", "Nothing in here. Go away.")

                    ;RESET THE TEST TYPE TO INITIAL CHOICE
                    ControlSend("Optima Rate Import Test Case Creator", "Test Type", $TestType_field, "i")

                Case "Add Analysis Stage"
                    GUIDelete($ControlGUI)

                    ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS
                    $ControlGUI = GUICreate("", 920, 220, $x1, $y1, $WS_CHILD, -1, $MainGUI)
                    GUISetBkColor(0xFFFFFF)
                    GUICtrlCreateGroup("Please set the Test Case parameters", $x1, 0, 910, 220)

                    $AdditionalDetails_label = GUICtrlCreateLabel("Additional Details", $x1 + 320, $y1 + 50, 90, 15)
                    $AdditionalDetails_field = GUICtrlCreateCombo("", $x1 + 420, $y1 + 50, 170, 20, $CBS_DROPDOWNLIST)
                    GUICtrlSetData($AdditionalDetails_field, "Run All Scripts|Run Script A001|Run Script A002|Run Script A003|Run Script A004|", "Run All Scripts")

                    GUISetState()


                Case "Run SQL File"
                    GUIDelete($ControlGUI)

                    ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS
                    $ControlGUI = GUICreate("", 920, 220, $x1, $y1, $WS_CHILD, -1, $MainGUI)
                    GUISetBkColor(0xFFFFFF)
                    GUICtrlCreateGroup("Please set the Test Case parameters", $x1, 0, 910, 220)

                    $ServerDetails_label = GUICtrlCreateLabel("Server Details Name", $x1 + 10, $y1 + 170, 90, 15)
                    $ServerDetails_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 170, 170, 20)

                    $UidPass_label = GUICtrlCreateLabel("User Id/Password", $x1 + 320, $y1 + 170, 90, 15)
                    $UidPass_field = GUICtrlCreateInput("", $x1 + 420, $y1 + 170, 170, 20)

                    GUISetState()
                    MsgBox(0, "How did you end up here?", "Nothing in here. Go away.")

                    ;RESET THE TEST TYPE TO INITIAL CHOICE
                    ControlSend("Optima Rate Import Test Case Creator", "Test Type", $TestType_field, "i")

                Case "Run Win Batch File"
                    GUIDelete($ControlGUI)

                    ; CREATE A CHILD GUI TO THE MAIN GUI WHICH WILL HOLD ALL THE DYNAMIC CONTROLS
                    $ControlGUI = GUICreate("", 920, 220, $x1, $y1, $WS_CHILD, -1, $MainGUI)
                    GUISetBkColor(0xFFFFFF)
                    GUICtrlCreateGroup("Please set the Test Case parameters", $x1, 0, 910, 220)

                    $ServerDetails_label = GUICtrlCreateLabel("Server Details Name", $x1 + 10, $y1 + 170, 90, 15)
                    $ServerDetails_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 170, 170, 20)

                    $UidPass_label = GUICtrlCreateLabel("User Id/Password", $x1 + 320, $y1 + 170, 90, 15)
                    $UidPass_field = GUICtrlCreateInput("", $x1 + 420, $y1 + 170, 170, 20)

                    GUISetState()
                    MsgBox(0, "How did you end up here?", "Nothing in here. Go away.")

                    ;RESET THE TEST TYPE TO INITIAL CHOICE
                    ControlSend("Optima Rate Import Test Case Creator", "Test Type", $TestType_field, "i")


            EndSwitch

;~ -----------------------------------------------------------------------------------------------------------------

        Case $GUI_EVENT_CLOSE
            SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav")
            GUIDelete()
            Exit

        Case $SaveBatch_button
            SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav")

            $Grid_listdata_sections = IniReadSectionNames($ProfilesINI)
            If @error = 1 Then
                $SectionNumber_data = 1
            Else
                $SectionNumber_data = $Grid_listdata_sections[0] + 1
            EndIf
            IniWriteSection($ProfilesINI, $SectionNumber_data, "")

            $Timestamp_data = @MDAY & @MON & @YEAR & @HOUR & @MIN & @SEC
            IniWrite($ProfilesINI, $SectionNumber_data, "TIMESTAMP", $Timestamp_data)

            $TestCaseStatus_data = ""
            IniWrite($ProfilesINI, $SectionNumber_data, "TEST CASE STATUS", $TestCaseStatus_data)

            $OverallResult_data = "Queued"
            IniWrite($ProfilesINI, $SectionNumber_data, "OVERALL RESULT", $OverallResult_data)

            $TCName_data = ControlGetText("Optima Rate Import Test Case Creator", "Test Case Name", $TCName_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "TEST CASE NAME", $TCName_data)

            $TCPassNo_data = ControlGetText("Optima Rate Import Test Case Creator", "Pass Number", $TCPassNo_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "PASS NUMBER", $TCPassNo_data)

            $CarrierName_data = ControlGetText("Optima Rate Import Test Case Creator", "Carrier Name", $CarrierName_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "CARRIER NAME", $CarrierName_data)

            $TestType_data = ControlGetText("Optima Rate Import Test Case Creator", "Test Type", $TestType_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "TEST TYPE", $TestType_data)

            $AdditionalDetails_data = ControlGetText("Optima Rate Import Test Case Creator", "Additional Details", $AdditionalDetails_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "DETAILS", $AdditionalDetails_data)

            $ServerDetails_data = ControlGetText("Optima Rate Import Test Case Creator", "Server Details Name", $ServerDetails_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "Server Details", $ServerDetails_data)

            $IncrDate_data = GUICtrlRead($IncrDate_datefield)
            IniWrite($ProfilesINI, $SectionNumber_data, "INCREASE DATE", $IncrDate_data)

            $DecrDate_data = GUICtrlRead($DecrDate_datefield)
            IniWrite($ProfilesINI, $SectionNumber_data, "DECREASE DATE", $DecrDate_data)

            $Destnination_data = ControlGetText("Optima Rate Import Test Case Creator", "Destination Nam", $Destnination_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "DESTINATION", $Destnination_data)

            $DialCode_data = ControlGetText("Optima Rate Import Test Case Creator", "Rate", $DialCode_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "DIAL CODE", $DialCode_data)

            $UidPass_data = ControlGetText("Optima Rate Import Test Case Creator", "User Id/Password", $UidPass_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "USERID AND PASSWORD", $UidPass_data)

            $Rate_data = ControlGetText("Optima Rate Import Test Case Creator", "Rate", $Rate_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "RATE", $Rate_data)

            $EffDate_data = GUICtrlRead($EffDate_datefield)
            IniWrite($ProfilesINI, $SectionNumber_data, "EFFECTIVE DATE", $EffDate_data)

            $ExpDate_data = GUICtrlRead($ExpDate_datefield)
            IniWrite($ProfilesINI, $SectionNumber_data, "EXPIRY DATE", $ExpDate_data)

            $ImportFileLocation_data = ControlGetText("Optima Rate Import Test Case Creator", "Import File", $ImportFileLocation_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "IMPORT FILE", $ImportFileLocation_data)

            $RefDeffFileLocation_data = ControlGetText("Optima Rate Import Test Case Creator", "Reference File", $RefDeffFileLocation_field)
            IniWrite($ProfilesINI, $SectionNumber_data, "REFERENCE FILE", $RefDeffFileLocation_data)

            _RefreshGridData()

        Case $RemFromGrid_button
            SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav")
            $SelectedRow = _GUICtrlListView_GetSelectedIndices($BatchList_handle) + 1
            If $SelectedRow > 1 Then
                $Grid_listdata_sections = IniReadSectionNames($ProfilesINI)
                $Ini_Section_delete = $Grid_listdata_sections[$SelectedRow]
                IniDelete($ProfilesINI, $Ini_Section_delete)
                For $c = $Grid_listdata_sections[$SelectedRow] To $Grid_listdata_sections[0]
                    IniRenameSection($ProfilesINI, $Grid_listdata_sections[$c], $Grid_listdata_sections[$c] - 1)
                Next
            EndIf
            _RefreshGridData()


        Case $MoveUp_button
            $SelectedRow = _GUICtrlListView_GetSelectedIndices($BatchList_handle) + 1
            $Grid_listdata_sections = IniReadSectionNames($ProfilesINI)
            _ArraySort($Grid_listdata_sections, 0, 1)
            If $SelectedRow > 1 Then
                $Selected_section = $Grid_listdata_sections[$SelectedRow]
                $Above_section = $Grid_listdata_sections[$SelectedRow - 1]

                $temp = 9999999
                IniRenameSection($ProfilesINI, $Selected_section, $temp)
                IniRenameSection($ProfilesINI, $Above_section, $Grid_listdata_sections[$SelectedRow])
                IniRenameSection($ProfilesINI, $temp, $Grid_listdata_sections[$SelectedRow - 1])
            EndIf

            _RefreshGridData()

        Case $MoveDown_button
            SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav")
            $SelectedRow = _GUICtrlListView_GetSelectedIndices($BatchList_handle) + 1
            $Grid_listdata_sections = IniReadSectionNames($ProfilesINI)
            _ArraySort($Grid_listdata_sections, 0, 1)
            If $SelectedRow < $Grid_listdata_sections[0] Then
                $Selected_section = $Grid_listdata_sections[$SelectedRow]
                $Below_section = $Grid_listdata_sections[$SelectedRow + 1]

                MsgBox(0, $Selected_section, $Below_section)
                $temp = "xxx"
                IniRenameSection($ProfilesINI, $Selected_section, $temp)
                IniRenameSection($ProfilesINI, $Below_section, $Selected_section)
                IniRenameSection($ProfilesINI, $temp, $Below_section)
            EndIf

            _RefreshGridData()

        Case $AddSeparator_button
            SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav")

            $Grid_listdata_sections = IniReadSectionNames($ProfilesINI)
            If @error = 1 Then
                $SectionNumber_data = 1
            Else
                $SectionNumber_data = $Grid_listdata_sections[0] + 1
            EndIf
            IniWriteSection($ProfilesINI, $SectionNumber_data, "")

            $Timestamp_data = @MDAY & @MON & @YEAR & @HOUR & @MIN & @SEC
            IniWrite($ProfilesINI, $SectionNumber_data, "TIMESTAMP", $Timestamp_data)

            $TestCaseStatus_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "TEST CASE STATUS", $TestCaseStatus_data)

            $OverallResult_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "OVERALL RESULT", $OverallResult_data)

            $TCName_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "TEST CASE NAME", $TCName_data)

            $TCPassNo_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "PASS NUMBER", $TCPassNo_data)

            $CarrierName_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "CARRIER NAME", $CarrierName_data)

            $TestType_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "TEST TYPE", $TestType_data)

            $AdditionalDetails_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "DETAILS", $AdditionalDetails_data)

            $ServerDetails_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "Server Details", $ServerDetails_data)

            $AutoExpire_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "AUTOEXPIRE", $AutoExpire_data)

            $IncrDate_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "INCREASE DATE", $IncrDate_data)

            $DecrDate_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "DECREASE DATE", $DecrDate_data)

            $Destnination_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "DESTINATION", $Destnination_data)

            $DialCode_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "DIAL CODE", $DialCode_data)

            $UidPass_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "USERID AND PASSWORD", $UidPass_data)

            $Rate_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "RATE", $Rate_data)

            $EffDate_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "EFFECTIVE DATE", $EffDate_data)

            $ExpDate_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "EXPIRY DATE", $ExpDate_data)

            $ImportFileLocation_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "IMPORT FILE", $ImportFileLocation_data)

            $RefDeffFileLocation_data = "------------"
            IniWrite($ProfilesINI, $SectionNumber_data, "REFERENCE FILE", $RefDeffFileLocation_data)

            _RefreshGridData()

;~ -----------------------------------------------------------------------------------------------------------------

        Case $msg = $Tab_TCSuite

            $current = _GUICtrlTab_GetCurSel($Tab_TCSuite)
            $Tab_Name = _GUICtrlTab_GetItemText($Tab_TCSuite, $current)

            $ProfilesINI = @ScriptDir & "\Profiles\" & $Tab_Name & ".ini"
            ; This here is a temp solution to stop the contineous refrsh problem.
            If $current <> $GenericTempValue Then
                _RefreshGridData()
            EndIf
            $GenericTempValue = $current

    EndSwitch

;~ -----------------------------------------------------------------------------------------------------------------

    ; CREATE THE ABOUT SCREEN WHICH WILL BE LAUCHED BY USING F1
    If _IsPressed(70,$User32dll) Then
        $AboutScreen_GUI = GUICreate("About Automata v0.1 alpha", 500, 300, -1, -1)
        GUISetState()
        

;~      MsgBox(48,"About Automata v0.1 alpha","Rishav is having his pet gnomes slug it out on a worthwhile About screen." & @LF & "Have patience. One day hitting F1 will bear fruits.")
    EndIf

WEnd

;~ -----------------------------------------------------------------------------------------------------------------


DllClose($User32dll)

;~ -----------------------------------------------------------------------------------------------------------------

Func _RefreshGridData()
    $Grid_listdata_sections = IniReadSectionNames($ProfilesINI)
    If @error Then
        _GUICtrlListView_DeleteAllItems($BatchList_handle)
    ElseIf $Grid_listdata_sections[0] > 0 Then
        _GUICtrlListView_BeginUpdate($BatchList_handle)
        _GUICtrlListView_DeleteAllItems($BatchList_handle)

        For $a = 1 To $Grid_listdata_sections[0]

;~          _ArrayDisplay($Grid_listdata_sections)
            _ArraySort($Grid_listdata_sections, 0, 1)
;~          _ArrayDisplay($Grid_listdata_sections)
            $Grid_All_listdata = IniReadSection($ProfilesINI, $Grid_listdata_sections[$a])
            If Not @error Then
                If $Grid_All_listdata[0][0] > 0 Then
                    _GUICtrlListView_AddItem($BatchList_handle, $a)
                    _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, $Grid_listdata_sections[$a], 1)
                    For $b = 2 To $Grid_All_listdata[0][0]
                        _GUICtrlListView_AddSubItem($BatchList_handle, $a - 1, $Grid_All_listdata[$b][1], $b + 1)
                    Next
                EndIf
            EndIf
        Next
        For $a = 0 To _GUICtrlListView_GetColumnCount($BatchList_handle)
            _GUICtrlListView_SetColumnWidth($BatchList_handle, $a, $LVSCW_AUTOSIZE_USEHEADER)
        Next
        _GUICtrlListView_EndUpdate($BatchList_handle)
    EndIf
EndFunc   ;==>_RefreshGridData

;~ Func _AboutScreen()


;~  ;This window has 2 ok/enable-buttons
;~  $AboutScreen_GUI = GUICreate("About Automata v0.1 alpha", 500, 300, -1, -1)


;~  ; Create the first child window that is implemented into the main GUI
;~  $child1 = GUICreate("", 230, 170, 15, 35, BitOR($WS_CHILD, $WS_TABSTOP), -1, $AboutScreen_GUI)

;~  GUICtrlCreateTabItem("XXX|YYY|ZZZ")

;~  GUISetState()

;~  ; Create the second child window that is implemented into the main GUI
;~  $child2 = GUICreate("", 230, 170, 15, 35, BitOR($WS_CHILD, $WS_TABSTOP), -1, $AboutScreen_GUI)
;~  $listview2 = GUICtrlCreateListView("Col1|Col2", 10, 10, 210, 150, -1, $WS_EX_CLIENTEDGE)
;~  GUICtrlCreateListViewItem("ItemLong1|ItemLong12", $listview2)
;~  GUICtrlCreateListViewItem("ItemLong2|Item22", $listview2)

;~  ; Switch back the main GUI and create the tabs
;~  GUISwitch($AboutScreen_GUI)
;~  $main_tab = GUICtrlCreateTab(10, 10, 240, 200)
;~  $child1tab = GUICtrlCreateTabItem("About")
;~  $child2tab = GUICtrlCreateTabItem("Help")
;~  $child3tab = GUICtrlCreateTabItem("Contact")
;~  GUICtrlCreateTabItem("")

;~  GUISetState()


;~  While 1
;~      $msg = GUIGetMsg(1)
;~      Switch $msg[0]
;~          Case $GUI_EVENT_CLOSE
;~              GUIDelete($AboutScreen_GUI)
;~          Case $main_tab
;~              Switch GUICtrlRead($main_tab)
;~                  Case 0
;~                      GUISetState(@SW_HIDE, $child2)
;~                      GUISetState(@SW_SHOW, $child1)

;~                  Case 1
;~                      GUISetState(@SW_HIDE, $child1)
;~                      GUISetState(@SW_SHOW, $child2)
;~              EndSwitch
;~      EndSwitch
;~  WEnd

;~ EndFunc   ;==>_AboutScreen

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Its the way your loop is setup. Let me try something with the ContextHelp >_<

EDIT:

Okay I'm too lazy to make a full example. Save the file I linked to earlier, and include it into your main script (just do #include<saved_file.au3>). Comment the current help window stuff (_IsPressed Part).

Find some controls your users may want info on. After their creation do the following:

_ContextHelp_SetText($hControl, $sText)

And walla. Help tooltip.

If this isn't what you want, try the following:

Remove/comment the _IsPressed part. Add the following:

Global $AboutScreen_GUI = 0
HotKeySet ("{F1}", "_MyHelp")

Find your $GUI_EVENT_CLOSE statement. Replace it with something like this:

Case $GUI_EVENT_CLOSE
    If $msg[1] = $AboutScreen_GUI Then
        GUIDelete($AboutScreen_GUI)
        $AboutScreen_GUI = 0
    Else
        SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav")
        Exit
    EndIf

Add the following function:

Func _MyHelp()
    $AboutScreen_GUI = GUICreate("About Automata v0.1 alpha", 500, 300, -1, -1)
    GUISetState()
EndFunc   ;==>_MyHelp
Edited by BrettF

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Case $GUI_EVENT_CLOSE
    If $msg[1] = $AboutScreen_GUI Then
        GUIDelete($AboutScreen_GUI)
        $AboutScreen_GUI = 0
    Else
        SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav")
        Exit
    EndIf

Thats exactly what the doc ordered. But why are we putting $AboutScreen_GUI = 0 in both during declarations and in the Case statement?

thanks and regards

Rishav

Edited by Rishav

Share this post


Link to post
Share on other sites

First is global, so that if you try close the original GUI without pressing help, it won't error. And if you wonder why it is 0, it is because as far as I know the HWND is always non-zero, so we don't have to worry about by doing that. In the function we are making the variable contain the handle to the window, required for the close function.

Cheers,

Brett

Share this post


Link to post
Share on other sites

ooh.. neat.

thanks a lot for taking the time Brett. Muchos Gracios.

regards

Rishav

Share this post


Link to post
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
Sign in to follow this  
Followers 0