Jump to content

Recommended Posts

Posted (edited)

Hello folks

Need a small help. I have a date time picker with a checkbox in it using the following code;

#Include <GuiDateTimePicker.au3>
$IncrDate_date=GuiCtrlCreateDate("", $x1 + 620, $y1 + 210, 200, 20,BitOR($DTS_SHOWNONE,$DTS_LONGDATEFORMAT))

Problem is that the checkbox is always checked by default but i want it to be unchecked by default. Any ideas?

regards

Rishav

Edited by Rishav
Posted

Hello folks

Need a small help. I have a date time picker with a checkbox in it using the following code;

#Include <GuiDateTimePicker.au3>
$IncrDate_date=GuiCtrlCreateDate("", $x1 + 620, $y1 + 210, 200, 20,BitOR($DTS_SHOWNONE,$DTS_LONGDATEFORMAT))

Problem is that the checkbox is always checked by default but i want it to be unchecked by default. Any ideas?

regards

Rishav

$hDate = GUICtrlGetHandle($IncrDate_date)

$tDate = 0

_GUICtrlDTP_SetSystemTimeEx($hDate, $tDate, True)

Posted

$hDate = GUICtrlGetHandle($IncrDate_date)

$tDate = 0

_GUICtrlDTP_SetSystemTimeEx($hDate, $tDate, True)

Wootage!! it works!

can't believe that i missed that flag option after nosing around in that help section for a coupla hours. :)

thanks a lot Yashied. btw, what does the $tDate variable do?

regards

Rishav

Posted

Wootage!! it works!

can't believe that i missed that flag option after nosing around in that help section for a coupla hours. :)

thanks a lot Yashied. btw, what does the $tDate variable do?

regards

Rishav

Since there parameter is ByRef, you need something to pass.
Posted

Hi

I have another problem related with the current topic.

Now I cannot check/uncheck the checkbox in the date field using the mouse. Space-bar works fine, however. Any ideas?

regards

Rishav

Posted
Posted

This is where I define the date field.

$ExpDate_label = GuiCtrlCreateLabel("Use Expiry Date", $x1 + 630, $y1 + 140, 130, 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)
Posted (edited)

This is where I define the date field.

$ExpDate_label = GuiCtrlCreateLabel("Use Expiry Date", $x1 + 630, $y1 + 140, 130, 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)

If you want to get help from us, post the ready to run code. OK? Edited by Yashied
Posted

There you go.

#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>


;~ GUI Backend data file
$ProfilesINI = @ScriptDir & "\Profiles\Profiles.ini"


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

$x1 = 10
$y1 = 10
GUICtrlCreateGroup("Please set the Path parameters", $x1, $y1, 920, 230)


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

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

$CarrierName_label = GUICtrlCreateLabel("Carrier Name", $x1 + 630, $y1 + 20, 130, 15)
$CarrierName_field = GUICtrlCreateInput("", $x1 + 730, $y1 + 20, 170, 20)

$TestType_label = GUICtrlCreateLabel("Test Type",  $x1 + 10, $y1 + 50, 130, 15)
$TestType_field = GUICtrlCreateCombo("", $x1 + 110, $y1 + 50, 170, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData($TestType_field, "Import Carrier Rates|Edit Carrier Rates", "Import Carrier Rates") 

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

$Extra1_label = GUICtrlCreateLabel("Extra field 01", $x1 + 630, $y1 + 50, 130, 15)
$Extra1_field = GUICtrlCreateInput("", $x1 + 730, $y1 + 50, 170, 20)


; CHECKBOX
$AutoExpire_Chkbox=GuiCtrlCreateCheckbox("Automatically Expire Previously Priced Destinations", $x1 + 10, $y1 + 80, 250, 20)


; DATES
$IncrDate_label=GuiCtrlCreateLabel("Increase Date", $x1 + 320, $y1 + 80, 130, 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, 130, 20)
$DecrDate_datefield=GuiCtrlCreateDate("", $x1 + 730, $y1 + 80, 170, 20)
$DecrDate_handle = GUICtrlGetHandle($DecrDate_datefield)
_GUICtrlDTP_SetFormat($DecrDate_handle, "ddd, dd/MMM/yy")


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

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

$Extra2_label = GUICtrlCreateLabel("Extra field 02", $x1 + 630, $y1 + 110, 130, 15)
$Extra2_field = GUICtrlCreateInput("", $x1 + 730, $y1 + 110, 170, 20)


; DETAILS FIELDS
$Rate_label = GUICtrlCreateLabel("Rate",$x1 + 10, $y1 + 140, 130, 15)
$Rate_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 140, 170, 20)


;~ CHECKBOXED DATE
$tDate = 0

$EffDate_label = GuiCtrlCreateLabel("Use Effective Date", $x1 + 320, $y1 + 140, 130, 20)
$EffDate_datefield = GuiCtrlCreateDate("", $x1 + 420, $y1 + 140, 170, 20,BitOR($DTS_SHOWNONE,$DTS_LONGDATEFORMAT))
;~ $EffDate_datefield =_GUICtrlDTP_Create($MainGUI, $x1 + 420, $y1 + 140, 170, 20,$DTS_SHOWNONE)
$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, 130, 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) 



;~ $DatafileLocation_value = IniRead($ProfilesINI, "Paths", "$DatafileLocation", "Field Missing")
$RSDeffFileLocation_label = GUICtrlCreateLabel("Template File", $x1 + 10, $y1 + 170, 130, 15)
$RSDeffFileLocation_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 170, 670, 20)
$RSDeffFileLocation_button = GUICtrlCreateButton("Browse", $x1 + 830, $y1 + 170, 50, 20)

$RefDeffFileLocation_label = GUICtrlCreateLabel("Reference File", $x1 + 10, $y1 + 200, 130, 15)
$RefDeffFileLocation_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 200, 670, 20)
$RefDeffFileLocation_button = GUICtrlCreateButton("Browse", $x1 + 830, $y1 + 200, 50, 20)


; 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)
$RunBatch_button=GuiCtrlCreateButton("Run Batch", $x1+930, $y1+180, 150, 40, $BS_DEFPUSHBUTTON)


; TC SUITE TABS
$Tab_TCSuite=_GUICtrlTab_Create($MainGUI, 0, 250, 1280)


; ADD TABS TO TAB BAR
_GUICtrlTab_InsertItem($Tab_TCSuite, 0, "TC Suite 1")
_GUICtrlTab_InsertItem($Tab_TCSuite, 1, "Tab 2")
_GUICtrlTab_InsertItem($Tab_TCSuite, 2, "This tab is awesome 3")
_GUICtrlTab_InsertItem($Tab_TCSuite, 3, "Tab 4")
_GUICtrlTab_InsertItem($Tab_TCSuite, 4, "Tab 5")
_GUICtrlTab_InsertItem($Tab_TCSuite, 5, "Tab 6")
_GUICtrlTab_InsertItem($Tab_TCSuite, 6, "Tab 7")


; LIST VIEW
$BatchList = GuiCtrlCreateListView("", 0, 280, 1100, 620, BitOR(-1, $LVS_NOSORTHEADER,$WS_VSCROLL), BitOR($LVS_EX_GRIDLINES,$LVS_EX_FULLROWSELECT,$LVS_EX_HEADERDRAGDROP ))
$Grid_serial_col=_GUICtrlListView_AddColumn($BatchList, "Serial No.",$LVSCW_AUTOSIZE_USEHEADER )
$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_Extra1_col=_GUICtrlListView_AddColumn($BatchList, "Extra1",$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_Extra2_col=_GUICtrlListView_AddColumn($BatchList, "Extra2",$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 )



; different statuses are ||(paused), >(Running), v(passed), x(failed)
GuiCtrlCreateListViewItem("A|One|Trident|Ponsus|Krakatua|11243525|87687|pippa", $BatchList)
GuiCtrlCreateListViewItem("B|Two|Trident|Ponsus|Krakatua|11243525|87687|pippa", $BatchList)
GuiCtrlCreateListViewItem("********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************", $BatchList)
GuiCtrlCreateListViewItem("C|Three|Trident|Ponsus|Krakatua|11243525|87687|pippa", $BatchList)


; DISABLE ALL CARRIER RATES FIELDS CURRENTLY
GUICtrlSetState ( $AdditionalDetails_field, $GUI_DISABLE )
GUICtrlSetState ( $Extra1_field, $GUI_DISABLE )
GUICtrlSetState ( $Destnination_field, $GUI_DISABLE )
GUICtrlSetState ( $DialCode_field, $GUI_DISABLE )
GUICtrlSetState ( $Extra2_field, $GUI_DISABLE )
GUICtrlSetState ( $Rate_field, $GUI_DISABLE )
GUICtrlSetState ( $EffDate_datefield, $GUI_DISABLE )
GUICtrlSetState ( $ExpDate_datefield, $GUI_DISABLE )


; GUI MESSAGE LOOP
GuiSetState()


; Capture and execute all button clicks
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $RSDeffFileLocation_button
            $var = FileSaveDialog ("Choose the DB Datafiles Folder", @WorkingDir , "Text files (*.ini;*.txt)")
            GUICtrlSetData($RSDeffFileLocation_field, $var)
        Case $msg = $RefDeffFileLocation_button
            $var = FileSaveDialog ("Choose the DB Datafiles Folder", @WorkingDir, "Text files (*.ini;*.txt)")
            GUICtrlSetData($RefDeffFileLocation_field, $var)
;~      Case $msg = $SVNClientFolder_button
;~          $var = FileSelectFolder("Choose the DB Datafiles Folder", "")
;~          GUICtrlSetData($SVNClientFolder_field, $var)
;~      Case $msg = $ClientInstallFolder_button
;~          $var = FileSelectFolder("Choose the DB Datafiles Folder", "")
;~          GUICtrlSetData($ClientInstallFolder_field, $var)
;~      Case $msg = $LicenseGeneratorFolder_button
;~          $var = FileSelectFolder("Choose the DB Datafiles Folder", "")
;~          GUICtrlSetData($LicenseGeneratorFolder_field, $var)
;~      Case ControlGetText("Optima Rate Import Test Case Creator", "Test Case Name",$TestType_field)="Import Carrier Rates"
;~          GUISetState($ExpDate_datefield,$GUI_DISABLE)
        Case $msg = $GUI_EVENT_CLOSE
            SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav")
            Exit
        Case $msg = $SaveBatch_button
            SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav")
            
            $Timestamp_data = @Mday & @MON & @YEAR & "_" & @HOUR & @MIN & @SEC
            IniWriteSection ( $ProfilesINI, $Timestamp_data, "")
            
            $TestCaseStatus_data=""
            IniWrite ($ProfilesINI, $Timestamp_data, "TEST CASE STATUS", $TestCaseStatus_data)
            
            $OverallResult_data=""
            IniWrite ($ProfilesINI, $Timestamp_data, "OVERALL RESULT", $OverallResult_data)
            
            $TCName_data = ControlGetText("Optima Rate Import Test Case Creator", "Test Case Name", $TCName_field)
            IniWrite($ProfilesINI, $Timestamp_data, "TEST CASE NAME", $TCName_data)

            $TCPassNo_data = ControlGetText("Optima Rate Import Test Case Creator", "Pass Number", $TCPassNo_field)
            IniWrite($ProfilesINI, $Timestamp_data, "PASS NUMBER", $TCPassNo_data)
            
            $CarrierName_data = ControlGetText("Optima Rate Import Test Case Creator", "Carrier Name", $CarrierName_field)
            IniWrite($ProfilesINI, $Timestamp_data, "CARRIER NAME", $CarrierName_data)
            
            $TestType_data = ControlGetText("Optima Rate Import Test Case Creator", "Test Type", $TestType_field)
            IniWrite($ProfilesINI, $Timestamp_data, "TEST TYPE", $TestType_data)
            
            $AdditionalDetails_data = ControlGetText("Optima Rate Import Test Case Creator", "Additional Details", $AdditionalDetails_field)
            IniWrite($ProfilesINI, $Timestamp_data, "DETAILS", $AdditionalDetails_data)
            
            $Extra1_data = ControlGetText("Optima Rate Import Test Case Creator", "Extra field 01", $Extra1_field)
            IniWrite($ProfilesINI, $Timestamp_data, "EXTRA1", $Extra1_data)
            
            $AutoExpire_data = ControlCommand ("Optima Rate Import Test Case Creator", "Automatically Expire Previously Priced Destinations", $AutoExpire_Chkbox, "IsChecked", "")
            IniWrite($ProfilesINI, $Timestamp_data, "AUTOEXPIRE", $AutoExpire_data)
            
            $IncrDate_data = GUICtrlRead($IncrDate_datefield)
            IniWrite($ProfilesINI, $Timestamp_data, "INCREASE DATE", $IncrDate_data)
            
            $DecrDate_data = GUICtrlRead($DecrDate_datefield)
            IniWrite($ProfilesINI, $Timestamp_data, "DECREASE DATE", $DecrDate_data)
            
            $Destnination_data = ControlGetText("Optima Rate Import Test Case Creator", "Destination Nam", $Destnination_field)
            IniWrite($ProfilesINI, $Timestamp_data, "DESTINATION", $Destnination_data)
            
            $DialCode_data = ControlGetText("Optima Rate Import Test Case Creator", "Rate", $DialCode_field)
            IniWrite($ProfilesINI, $Timestamp_data, "DIAL CODE", $DialCode_data)
            
            $Extra2_data = ControlGetText("Optima Rate Import Test Case Creator", "Extra field 02", $Extra2_field)
            IniWrite($ProfilesINI, $Timestamp_data, "EXTRA2", $Extra2_data)
            
            $Rate_data = ControlGetText("Optima Rate Import Test Case Creator", "Rate", $Rate_field)
            IniWrite($ProfilesINI, $Timestamp_data, "RATE", $Rate_data)
            
            $EffDate_data = GUICtrlRead($EffDate_datefield)
            IniWrite($ProfilesINI, $Timestamp_data, "EFFECTIVE DATE", $EffDate_data)
            
            $ExpDate_data = GUICtrlRead($ExpDate_datefield)
            IniWrite($ProfilesINI, $Timestamp_data, "EXPIRY DATE", $ExpDate_data)
            
            $RSDeffFileLocation_data = ControlGetText("Optima Rate Import Test Case Creator", "Template File", $RSDeffFileLocation_field)
            IniWrite($ProfilesINI, $Timestamp_data, "TEMPLATE FILE", $RSDeffFileLocation_data)
            
            $RefDeffFileLocation_data = ControlGetText("Optima Rate Import Test Case Creator", "Reference File", $RefDeffFileLocation_field)
            IniWrite($ProfilesINI, $Timestamp_data, "REFERENCE FILE", $RefDeffFileLocation_data)

    EndSelect
WEnd

;~ ADD TEST CASE NAME (EDITABLE DROP DOWN, IF SAME AS NEXT GRID ENTRY, AUTOMATICALLY PASS NO INCREMENTED), PASS NO(DEFAULT 1, IN COMPAR CODE IF THE CURRENT PASS IS >1, IT TAKES ALL SAME TEST CASE NAME AND EXPORTS DATA FOR PREVIOUS PASSES INCR AND DECR DATES), REMARKS.
;~ For dcl TEST CASES WITH DIFF mdl, CHANGE THE RATE SHEETS TO POINT A NEW SET OF DESTINATION OTHER THAN INDIA.
Posted

I am extremely sorry. try this code. the earlier code had some disabled fields.

#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>


;~ GUI Backend data file
$ProfilesINI = @ScriptDir & "\Profiles\Profiles.ini"


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

$x1 = 10
$y1 = 10
GUICtrlCreateGroup("Please set the Path parameters", $x1, $y1, 920, 230)


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

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

$CarrierName_label = GUICtrlCreateLabel("Carrier Name", $x1 + 630, $y1 + 20, 130, 15)
$CarrierName_field = GUICtrlCreateInput("", $x1 + 730, $y1 + 20, 170, 20)

$TestType_label = GUICtrlCreateLabel("Test Type",  $x1 + 10, $y1 + 50, 130, 15)
$TestType_field = GUICtrlCreateCombo("", $x1 + 110, $y1 + 50, 170, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData($TestType_field, "Import Carrier Rates|Edit Carrier Rates", "Import Carrier Rates") 

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

$Extra1_label = GUICtrlCreateLabel("Extra field 01", $x1 + 630, $y1 + 50, 130, 15)
$Extra1_field = GUICtrlCreateInput("", $x1 + 730, $y1 + 50, 170, 20)


; CHECKBOX
$AutoExpire_Chkbox=GuiCtrlCreateCheckbox("Automatically Expire Previously Priced Destinations", $x1 + 10, $y1 + 80, 250, 20)


; DATES
$IncrDate_label=GuiCtrlCreateLabel("Increase Date", $x1 + 320, $y1 + 80, 130, 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, 130, 20)
$DecrDate_datefield=GuiCtrlCreateDate("", $x1 + 730, $y1 + 80, 170, 20)
$DecrDate_handle = GUICtrlGetHandle($DecrDate_datefield)
_GUICtrlDTP_SetFormat($DecrDate_handle, "ddd, dd/MMM/yy")


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

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

$Extra2_label = GUICtrlCreateLabel("Extra field 02", $x1 + 630, $y1 + 110, 130, 15)
$Extra2_field = GUICtrlCreateInput("", $x1 + 730, $y1 + 110, 170, 20)


; DETAILS FIELDS
$Rate_label = GUICtrlCreateLabel("Rate",$x1 + 10, $y1 + 140, 130, 15)
$Rate_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 140, 170, 20)


;~ CHECKBOXED DATE
$tDate = 0

$EffDate_label = GuiCtrlCreateLabel("Use Effective Date", $x1 + 320, $y1 + 140, 130, 20)
$EffDate_datefield = GuiCtrlCreateDate("", $x1 + 420, $y1 + 140, 170, 20,BitOR($DTS_SHOWNONE,$DTS_LONGDATEFORMAT))
;~ $EffDate_datefield =_GUICtrlDTP_Create($MainGUI, $x1 + 420, $y1 + 140, 170, 20,$DTS_SHOWNONE)
$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, 130, 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) 



;~ $DatafileLocation_value = IniRead($ProfilesINI, "Paths", "$DatafileLocation", "Field Missing")
$RSDeffFileLocation_label = GUICtrlCreateLabel("Template File", $x1 + 10, $y1 + 170, 130, 15)
$RSDeffFileLocation_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 170, 670, 20)
$RSDeffFileLocation_button = GUICtrlCreateButton("Browse", $x1 + 830, $y1 + 170, 50, 20)

$RefDeffFileLocation_label = GUICtrlCreateLabel("Reference File", $x1 + 10, $y1 + 200, 130, 15)
$RefDeffFileLocation_field = GUICtrlCreateInput("", $x1 + 110, $y1 + 200, 670, 20)
$RefDeffFileLocation_button = GUICtrlCreateButton("Browse", $x1 + 830, $y1 + 200, 50, 20)


; 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)
$RunBatch_button=GuiCtrlCreateButton("Run Batch", $x1+930, $y1+180, 150, 40, $BS_DEFPUSHBUTTON)


; TC SUITE TABS
$Tab_TCSuite=_GUICtrlTab_Create($MainGUI, 0, 250, 1280)


; ADD TABS TO TAB BAR
_GUICtrlTab_InsertItem($Tab_TCSuite, 0, "TC Suite 1")
_GUICtrlTab_InsertItem($Tab_TCSuite, 1, "Tab 2")
_GUICtrlTab_InsertItem($Tab_TCSuite, 2, "This tab is awesome 3")
_GUICtrlTab_InsertItem($Tab_TCSuite, 3, "Tab 4")
_GUICtrlTab_InsertItem($Tab_TCSuite, 4, "Tab 5")
_GUICtrlTab_InsertItem($Tab_TCSuite, 5, "Tab 6")
_GUICtrlTab_InsertItem($Tab_TCSuite, 6, "Tab 7")


; LIST VIEW
$BatchList = GuiCtrlCreateListView("", 0, 280, 1100, 620, BitOR(-1, $LVS_NOSORTHEADER,$WS_VSCROLL), BitOR($LVS_EX_GRIDLINES,$LVS_EX_FULLROWSELECT,$LVS_EX_HEADERDRAGDROP ))
$Grid_serial_col=_GUICtrlListView_AddColumn($BatchList, "Serial No.",$LVSCW_AUTOSIZE_USEHEADER )
$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_Extra1_col=_GUICtrlListView_AddColumn($BatchList, "Extra1",$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_Extra2_col=_GUICtrlListView_AddColumn($BatchList, "Extra2",$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 )



; different statuses are ||(paused), >(Running), v(passed), x(failed)
GuiCtrlCreateListViewItem("A|One|Trident|Ponsus|Krakatua|11243525|87687|pippa", $BatchList)
GuiCtrlCreateListViewItem("B|Two|Trident|Ponsus|Krakatua|11243525|87687|pippa", $BatchList)
GuiCtrlCreateListViewItem("********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************|********************", $BatchList)
GuiCtrlCreateListViewItem("C|Three|Trident|Ponsus|Krakatua|11243525|87687|pippa", $BatchList)


; DISABLE ALL CARRIER RATES FIELDS CURRENTLY
;~ GUICtrlSetState ( $AdditionalDetails_field, $GUI_DISABLE )
;~ GUICtrlSetState ( $Extra1_field, $GUI_DISABLE )
;~ GUICtrlSetState ( $Destnination_field, $GUI_DISABLE )
;~ GUICtrlSetState ( $DialCode_field, $GUI_DISABLE )
;~ GUICtrlSetState ( $Extra2_field, $GUI_DISABLE )
;~ GUICtrlSetState ( $Rate_field, $GUI_DISABLE )
;~ GUICtrlSetState ( $EffDate_datefield, $GUI_DISABLE )
;~ GUICtrlSetState ( $ExpDate_datefield, $GUI_DISABLE )


; GUI MESSAGE LOOP
GuiSetState()


; Capture and execute all button clicks
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $RSDeffFileLocation_button
            $var = FileSaveDialog ("Choose the DB Datafiles Folder", @WorkingDir , "Text files (*.ini;*.txt)")
            GUICtrlSetData($RSDeffFileLocation_field, $var)
        Case $msg = $RefDeffFileLocation_button
            $var = FileSaveDialog ("Choose the DB Datafiles Folder", @WorkingDir, "Text files (*.ini;*.txt)")
            GUICtrlSetData($RefDeffFileLocation_field, $var)
;~      Case $msg = $SVNClientFolder_button
;~          $var = FileSelectFolder("Choose the DB Datafiles Folder", "")
;~          GUICtrlSetData($SVNClientFolder_field, $var)
;~      Case $msg = $ClientInstallFolder_button
;~          $var = FileSelectFolder("Choose the DB Datafiles Folder", "")
;~          GUICtrlSetData($ClientInstallFolder_field, $var)
;~      Case $msg = $LicenseGeneratorFolder_button
;~          $var = FileSelectFolder("Choose the DB Datafiles Folder", "")
;~          GUICtrlSetData($LicenseGeneratorFolder_field, $var)
;~      Case ControlGetText("Optima Rate Import Test Case Creator", "Test Case Name",$TestType_field)="Import Carrier Rates"
;~          GUISetState($ExpDate_datefield,$GUI_DISABLE)
        Case $msg = $GUI_EVENT_CLOSE
            SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav")
            Exit
        Case $msg = $SaveBatch_button
            SoundPlay(@WindowsDir & "\media\Windows XP Pop-up Blocked.wav")
            
            $Timestamp_data = @Mday & @MON & @YEAR & "_" & @HOUR & @MIN & @SEC
            IniWriteSection ( $ProfilesINI, $Timestamp_data, "")
            
            $TestCaseStatus_data=""
            IniWrite ($ProfilesINI, $Timestamp_data, "TEST CASE STATUS", $TestCaseStatus_data)
            
            $OverallResult_data=""
            IniWrite ($ProfilesINI, $Timestamp_data, "OVERALL RESULT", $OverallResult_data)
            
            $TCName_data = ControlGetText("Optima Rate Import Test Case Creator", "Test Case Name", $TCName_field)
            IniWrite($ProfilesINI, $Timestamp_data, "TEST CASE NAME", $TCName_data)

            $TCPassNo_data = ControlGetText("Optima Rate Import Test Case Creator", "Pass Number", $TCPassNo_field)
            IniWrite($ProfilesINI, $Timestamp_data, "PASS NUMBER", $TCPassNo_data)
            
            $CarrierName_data = ControlGetText("Optima Rate Import Test Case Creator", "Carrier Name", $CarrierName_field)
            IniWrite($ProfilesINI, $Timestamp_data, "CARRIER NAME", $CarrierName_data)
            
            $TestType_data = ControlGetText("Optima Rate Import Test Case Creator", "Test Type", $TestType_field)
            IniWrite($ProfilesINI, $Timestamp_data, "TEST TYPE", $TestType_data)
            
            $AdditionalDetails_data = ControlGetText("Optima Rate Import Test Case Creator", "Additional Details", $AdditionalDetails_field)
            IniWrite($ProfilesINI, $Timestamp_data, "DETAILS", $AdditionalDetails_data)
            
            $Extra1_data = ControlGetText("Optima Rate Import Test Case Creator", "Extra field 01", $Extra1_field)
            IniWrite($ProfilesINI, $Timestamp_data, "EXTRA1", $Extra1_data)
            
            $AutoExpire_data = ControlCommand ("Optima Rate Import Test Case Creator", "Automatically Expire Previously Priced Destinations", $AutoExpire_Chkbox, "IsChecked", "")
            IniWrite($ProfilesINI, $Timestamp_data, "AUTOEXPIRE", $AutoExpire_data)
            
            $IncrDate_data = GUICtrlRead($IncrDate_datefield)
            IniWrite($ProfilesINI, $Timestamp_data, "INCREASE DATE", $IncrDate_data)
            
            $DecrDate_data = GUICtrlRead($DecrDate_datefield)
            IniWrite($ProfilesINI, $Timestamp_data, "DECREASE DATE", $DecrDate_data)
            
            $Destnination_data = ControlGetText("Optima Rate Import Test Case Creator", "Destination Nam", $Destnination_field)
            IniWrite($ProfilesINI, $Timestamp_data, "DESTINATION", $Destnination_data)
            
            $DialCode_data = ControlGetText("Optima Rate Import Test Case Creator", "Rate", $DialCode_field)
            IniWrite($ProfilesINI, $Timestamp_data, "DIAL CODE", $DialCode_data)
            
            $Extra2_data = ControlGetText("Optima Rate Import Test Case Creator", "Extra field 02", $Extra2_field)
            IniWrite($ProfilesINI, $Timestamp_data, "EXTRA2", $Extra2_data)
            
            $Rate_data = ControlGetText("Optima Rate Import Test Case Creator", "Rate", $Rate_field)
            IniWrite($ProfilesINI, $Timestamp_data, "RATE", $Rate_data)
            
            $EffDate_data = GUICtrlRead($EffDate_datefield)
            IniWrite($ProfilesINI, $Timestamp_data, "EFFECTIVE DATE", $EffDate_data)
            
            $ExpDate_data = GUICtrlRead($ExpDate_datefield)
            IniWrite($ProfilesINI, $Timestamp_data, "EXPIRY DATE", $ExpDate_data)
            
            $RSDeffFileLocation_data = ControlGetText("Optima Rate Import Test Case Creator", "Template File", $RSDeffFileLocation_field)
            IniWrite($ProfilesINI, $Timestamp_data, "TEMPLATE FILE", $RSDeffFileLocation_data)
            
            $RefDeffFileLocation_data = ControlGetText("Optima Rate Import Test Case Creator", "Reference File", $RefDeffFileLocation_field)
            IniWrite($ProfilesINI, $Timestamp_data, "REFERENCE FILE", $RefDeffFileLocation_data)

    EndSelect
WEnd

;~ ADD TEST CASE NAME (EDITABLE DROP DOWN, IF SAME AS NEXT GRID ENTRY, AUTOMATICALLY PASS NO INCREMENTED), PASS NO(DEFAULT 1, IN COMPAR CODE IF THE CURRENT PASS IS >1, IT TAKES ALL SAME TEST CASE NAME AND EXPORTS DATA FOR PREVIOUS PASSES INCR AND DECR DATES), REMARKS.
;~ For dcl TEST CASES WITH DIFF mdl, CHANGE THE RATE SHEETS TO POINT A NEW SET OF DESTINATION OTHER THAN INDIA.
Posted

Rishav, next time put your code in AutoIt box, please.

;~ CHECKBOXED DATE
$tDate = 0

$EffDate_label = GuiCtrlCreateLabel("Use Effective Date", $x1 + 320, $y1 + 140, 130, 20)
$EffDate_datefield = GuiCtrlCreateDate("", $x1 + 420, $y1 + 140, 170, 20,BitOR($DTS_SHOWNONE,$DTS_LONGDATEFORMAT))
;~ $EffDate_datefield =_GUICtrlDTP_Create($MainGUI, $x1 + 420, $y1 + 140, 170, 20,$DTS_SHOWNONE)
$EffDate_handle = GUICtrlGetHandle($EffDate_datefield)
_GUICtrlDTP_SetFormat($EffDate_handle, "ddd, dd/MMM/yy")
_GUICtrlDTP_SetSystemTimeEx($EffDate_handle, $tDate, True)

Here is $EffDate_datefield overlapped $EffDate_label.

Posted

Sheesh! Can't believe that the issue was so tiny and difficult to find. I spent hours trying different date time picker configs. :/

thanks again. And I'll keep the use of Autoit tag in mid.

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
×
×
  • Create New...