Sign in to follow this  
Followers 0
GAM

Read the selected values from UI and write it in text file

12 posts in this topic

#1 ·  Posted (edited)

Hi All,

I have created a script to meet my automation need. The plan is to read the  contents of the selected items in UI and then write the same to a text file. The code that I have with me is as below. Can someone  please help me how to  write the selected values to a text file?


 

; Example of TAB in TAB ctrl
#include <GUIConstants.au3>

Global $main_GUI,$ok_button,$cancel_button

; This window has 2 ok/cancel-buttons
$main_GUI       = GUICreate("TAB in TAB",1000,700,-1,-1)
$ok_button      = GUICtrlCreateButton("  OK  ",400,650,100,30)
$cancel_button  = GUICtrlCreateButton("  Cancel  ",530,650,100,30)

; Create the first child window that is implemented into the main GUI
$child1         = GUICreate("",940,547,25,82,BitOr($WS_CHILD,$WS_TABSTOP),-1,$main_GUI)
$child_tab      = GUICtrlCreateTab(5,5,929,539)
$child11tab     = GUICtrlCreateTabItem("::              Win 7             ::")
GUICtrlCreateLabel("Username", 20, 70, 100, 25)
UI_Scenario_Products()

$child12tab     = GUICtrlCreateTabItem("::              Win 8             ::")
UI_Scenario_Products()

$child13tab     = GUICtrlCreateTabItem("::              Win 8.1             ::")
UI_Scenario_Products()

$child14tab     = GUICtrlCreateTabItem("::              Win 10             ::")
UI_Scenario_Products()

$child15tab     = GUICtrlCreateTabItem("::              Win 10.1             ::")
UI_Scenario_Products()

GUICtrlCreateTabItem("")

GUISetState()

; Create the second child window that is implemented into the main GUI
$child2         = GUICreate("",940,355,25,82,BitOr($WS_CHILD,$WS_TABSTOP),-1,$main_GUI)
;$listview2      = GUICtrlCreateListView("Col1|Col2",10,10,910,315,-1,$WS_EX_CLIENTEDGE)
$child_tab      = GUICtrlCreateTab(5,5,930,335)
$child11tab     = GUICtrlCreateTabItem("::          Win 7     ::")
$child12tab     = GUICtrlCreateTabItem("::          Win 8         ::")
$child13tab     = GUICtrlCreateTabItem("::          Win 8.1         ::")
$child14tab     = GUICtrlCreateTabItem("::          Win 10         ::")
$child15tab     = GUICtrlCreateTabItem("::          Win 2K8 R2         ::")
$child11tab     = GUICtrlCreateTabItem("::          Win 2012 R2         ::")
$child12tab     = GUICtrlCreateTabItem("::          Win 2016         ::")

; Switch back the main GUI and create the tabs
GUISwitch($main_GUI)
$main_tab       = GUICtrlCreateTab(10,50,970,590)
$child1tab      = GUICtrlCreateTabItem("                                                                         32 Bit                                                                        ")
$child2tab      = GUICtrlCreateTabItem("                                                                         64 Bit                                                                        ")
GUICtrlCreateTabItem("")

GUISetState()
Dim $sMenutext

While 1
    $msg = GUIGetMsg(1)

    Switch $msg[0]
        Case $GUI_EVENT_CLOSE, $cancel_button
            ExitLoop

        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

Func UI_Scenario_Products()
   $Top = 150
   $Left = 120
   For $scenarios = 1 To 10 Step 1
         $idScenario = GUICtrlCreateLabel("Scenario - " & $scenarios, 20, $Top, 100, 25)
         For $Products = 1 To 8 Step 1
            $idProduct = GUICtrlCreateCombo("", $Left, $Top, 100, 25)
            $ComboSeletectItem = GUICtrlSetData($idProduct, "AAA 88 RP1|AAA 88 RP2|AAA 88 RP3|AAA 88 RP4|AAA 88 RP5|AAA 88 RP6|AAA 88 RP7|AAA 88 RP8|BBB 88 RP1|BBB 88 RP2|BBB 88 RP3", "")
            $Left = $Left + 100
         Next
   $Top = $Top + 35
   $Left = 120
   Next
EndFunc

 

Edited by GAM

Neil

Share this post


Link to post
Share on other sites



UI looks like this...

UI.png


Neil

Share this post


Link to post
Share on other sites

Please edit your post, using the code-tags  <> for your code.

Share this post


Link to post
Share on other sites

Hi AutoBert, I have attached the temp.au3 file easy  view. 

temp.au3


Neil

Share this post


Link to post
Share on other sites
; Example of TAB in TAB ctrl
#include <GUIConstants.au3>

Global $main_GUI,$ok_button,$cancel_button

; This window has 2 ok/cancel-buttons
$main_GUI       = GUICreate("TAB in TAB",1000,700,-1,-1)
$ok_button      = GUICtrlCreateButton("  OK  ",400,650,100,30)
$cancel_button  = GUICtrlCreateButton("  Cancel  ",530,650,100,30)

; Create the first child window that is implemented into the main GUI
$child1         = GUICreate("",940,547,25,82,BitOr($WS_CHILD,$WS_TABSTOP),-1,$main_GUI)
$child_tab      = GUICtrlCreateTab(5,5,929,539)
$child11tab     = GUICtrlCreateTabItem("::              Win 7             ::")
GUICtrlCreateLabel("Username", 20, 70, 100, 25)
UI_Scenario_Products()

$child12tab     = GUICtrlCreateTabItem("::              Win 8             ::")
UI_Scenario_Products()

$child13tab     = GUICtrlCreateTabItem("::              Win 8.1             ::")
UI_Scenario_Products()

$child14tab     = GUICtrlCreateTabItem("::              Win 10             ::")
UI_Scenario_Products()

$child15tab     = GUICtrlCreateTabItem("::              Win 10.1             ::")
UI_Scenario_Products()

GUICtrlCreateTabItem("")

GUISetState()

; Create the second child window that is implemented into the main GUI
$child2         = GUICreate("",940,355,25,82,BitOr($WS_CHILD,$WS_TABSTOP),-1,$main_GUI)
;$listview2      = GUICtrlCreateListView("Col1|Col2",10,10,910,315,-1,$WS_EX_CLIENTEDGE)
$child_tab      = GUICtrlCreateTab(5,5,930,335)
$child11tab     = GUICtrlCreateTabItem("::          Win 7     ::")
$child12tab     = GUICtrlCreateTabItem("::          Win 8         ::")
$child13tab     = GUICtrlCreateTabItem("::          Win 8.1         ::")
$child14tab     = GUICtrlCreateTabItem("::          Win 10         ::")
$child15tab     = GUICtrlCreateTabItem("::          Win 2K8 R2         ::")
$child11tab     = GUICtrlCreateTabItem("::          Win 2012 R2         ::")
$child12tab     = GUICtrlCreateTabItem("::          Win 2016         ::")



; Switch back the main GUI and create the tabs
GUISwitch($main_GUI)
$main_tab       = GUICtrlCreateTab(10,50,970,590)
$child1tab      = GUICtrlCreateTabItem("                                                                         32 Bit                                                                        ")
$child2tab      = GUICtrlCreateTabItem("                                                                         64 Bit                                                                        ")
GUICtrlCreateTabItem("")

GUISetState()
Dim $sMenutext

While 1
    $msg = GUIGetMsg(1)

    Switch $msg[0]
        Case $GUI_EVENT_CLOSE, $cancel_button
            ExitLoop

        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

Func UI_Scenario_Products()
   $Top = 150
   $Left = 120
   For $scenarios = 1 To 10 Step 1
         $idScenario = GUICtrlCreateLabel("Scenario - " & $scenarios, 20, $Top, 100, 25)
         For $Products = 1 To 8 Step 1
            $idProduct = GUICtrlCreateCombo("", $Left, $Top, 100, 25)
            $ComboSeletectItem = GUICtrlSetData($idProduct, "AAA 88 RP1|AAA 88 RP2|AAA 88 RP3|AAA 88 RP4|AAA 88 RP5|AAA 88 RP6|AAA 88 RP7|AAA 88 RP8|BBB 88 RP1|BBB 88 RP2|BBB 88 RP3", "")
            $Left = $Left + 100
         Next
   $Top = $Top + 35
   $Left = 120
   Next
EndFunc

 


Neil

Share this post


Link to post
Share on other sites

Without changing the creation of the GUI-Controls it isn't possible to get data from all. The comcos need all a controlid so i suggest to create them in a array:

Global $idProduct[5][10][8]
;5 Tabs         this must be changed for 2. Child
;10 scenarios
;8 Products

change func

Func UI_Scenario_Products($iTab)
    $Top = 150
    $Left = 120
    For $iScenarios = 0 To 9
        $idScenario = GUICtrlCreateLabel("Scenario - " & $iScenarios + 1, 20, $Top, 100, 25)
        For $iProducts = 0 To 7
            $idProduct[$iTab][$iScenarios][$iProducts] = GUICtrlCreateCombo("", $Left, $Top, 100, 25)
            $ComboSeletectItem = GUICtrlSetData($idProduct[$iTab][$iScenarios][$iProducts], "AAA 88 RP1|AAA 88 RP2|AAA 88 RP3|AAA 88 RP4|AAA 88 RP5|AAA 88 RP6|AAA 88 RP7|AAA 88 RP8|BBB 88 RP1|BBB 88 RP2|BBB 88 RP3", "")
            $Left = $Left + 100
        Next
        $Top = $Top + 35
        $Left = 120
    Next
EndFunc   ;==>UI_Scenario_Products

after you can read each control's data:

Case $ok_button
            $hOutFile = FileOpen('products.txt', $FO_OVERWRITE)
            For $iTab = 0 To 4
                For $iScenarios = 0 To 9
                    For $iProducts = 0 To 7
                        FileWriteLine($hOutFile, $iTab & '|' & $iScenarios & '|' & $iProducts & ': ' & GUICtrlRead($idProduct[$iTab][$iScenarios][$iProducts]))
                    Next
                Next
            Next
            FileClose($hOutFile)

and here the whole script:

; Example of TAB in TAB ctrl
#include <GUIConstants.au3>
#include <FileConstants.au3>

Global $main_GUI, $ok_button, $cancel_button
Global $idProduct[5][10][8]

; This window has 2 ok/cancel-buttons
$main_GUI = GUICreate("TAB in TAB", 1000, 700, -1, -1)
$ok_button = GUICtrlCreateButton("  OK  ", 400, 650, 100, 30)
$cancel_button = GUICtrlCreateButton("  Cancel  ", 530, 650, 100, 30)

; Create the first child window that is implemented into the main GUI
$child1 = GUICreate("", 940, 547, 25, 82, BitOR($WS_CHILD, $WS_TABSTOP), -1, $main_GUI)
$child_tab = GUICtrlCreateTab(5, 5, 929, 539)
$child11tab = GUICtrlCreateTabItem("::              Win 7             ::")
GUICtrlCreateLabel("Username", 20, 70, 100, 25)
UI_Scenario_Products(0)

$child12tab = GUICtrlCreateTabItem("::              Win 8             ::")
UI_Scenario_Products(1)

$child13tab = GUICtrlCreateTabItem("::              Win 8.1             ::")
UI_Scenario_Products(2)

$child14tab = GUICtrlCreateTabItem("::              Win 10             ::")
UI_Scenario_Products(3)

$child15tab = GUICtrlCreateTabItem("::              Win 10.1             ::")
UI_Scenario_Products(4)

GUICtrlCreateTabItem("")

GUISetState()

; Create the second child window that is implemented into the main GUI
$child2 = GUICreate("", 940, 355, 25, 82, BitOR($WS_CHILD, $WS_TABSTOP), -1, $main_GUI)
;$listview2      = GUICtrlCreateListView("Col1|Col2",10,10,910,315,-1,$WS_EX_CLIENTEDGE)
$child_tab = GUICtrlCreateTab(5, 5, 930, 335)
$child11tab = GUICtrlCreateTabItem("::          Win 7     ::")
$child12tab = GUICtrlCreateTabItem("::          Win 8         ::")
$child13tab = GUICtrlCreateTabItem("::          Win 8.1         ::")
$child14tab = GUICtrlCreateTabItem("::          Win 10         ::")
$child15tab = GUICtrlCreateTabItem("::          Win 2K8 R2         ::")
$child11tab = GUICtrlCreateTabItem("::          Win 2012 R2         ::")
$child12tab = GUICtrlCreateTabItem("::          Win 2016         ::")



; Switch back the main GUI and create the tabs
GUISwitch($main_GUI)
$main_tab = GUICtrlCreateTab(10, 50, 970, 590)
$child1tab = GUICtrlCreateTabItem("                                                                         32 Bit                                                                        ")
$child2tab = GUICtrlCreateTabItem("                                                                         64 Bit                                                                        ")
GUICtrlCreateTabItem("")

GUISetState()
Dim $sMenutext

While 1
    $msg = GUIGetMsg(1)

    Switch $msg[0]
        Case $GUI_EVENT_CLOSE, $cancel_button
            ExitLoop
        Case $ok_button
            $hOutFile = FileOpen('products.txt', $FO_OVERWRITE)
            For $iTab = 0 To 4
                For $iScenarios = 0 To 9
                    For $iProducts = 0 To 7
                        FileWriteLine($hOutFile, $iTab & '|' & $iScenarios & '|' & $iProducts & ': ' & GUICtrlRead($idProduct[$iTab][$iScenarios][$iProducts]))
                    Next
                Next
            Next
            FileClose($hOutFile)
        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

Func UI_Scenario_Products($iTab)
    $Top = 150
    $Left = 120
    For $iScenarios = 0 To 9
        $idScenario = GUICtrlCreateLabel("Scenario - " & $iScenarios + 1, 20, $Top, 100, 25)
        For $iProducts = 0 To 7
            $idProduct[$iTab][$iScenarios][$iProducts] = GUICtrlCreateCombo("", $Left, $Top, 100, 25)
            $ComboSeletectItem = GUICtrlSetData($idProduct[$iTab][$iScenarios][$iProducts], "AAA 88 RP1|AAA 88 RP2|AAA 88 RP3|AAA 88 RP4|AAA 88 RP5|AAA 88 RP6|AAA 88 RP7|AAA 88 RP8|BBB 88 RP1|BBB 88 RP2|BBB 88 RP3", "")
            $Left = $Left + 100
        Next
        $Top = $Top + 35
        $Left = 120
    Next
EndFunc   ;==>UI_Scenario_Products

note:

  • You have to complete $Child2.
  • The textfile generation is only basic, you have to polish

 

Share this post


Link to post
Share on other sites

Hi AutoBert, Thanks a ton for the help.! This is exactly what am looking for. Yeah like you mentioned I will polish the output in a different format.

 

Thanks again for the help!!


Neil

Share this post


Link to post
Share on other sites

Hi, I have made further changes to the code to print the "Products" per scenario. I have now added 3 more testboxes (VMName, Username and Password). I wanted the TEXT/CONTENTS entered inside these boxes to be printed too in the text file, something like "vname, username, password" per tab. Can ask you favor again to help me out for this extended feature?

 

The modified code...

#include <ColorConstants.au3>
#include <GUIConstants.au3>
#include <FileConstants.au3>
#include <StringConstants.au3>
#include <MsgBoxConstants.au3>

Global $main_GUI, $ok_button, $cancel_button
Global $idProduct[5][10][8]
Global $idCreds[5][3]
Global $iLabel[5][3]

; This window has 2 ok/cancel-buttons
$main_GUI = GUICreate("Planner", 1000, 700, -1, -1)
$ok_button = GUICtrlCreateButton("  OK  ", 400, 650, 100, 30)
$cancel_button = GUICtrlCreateButton("  Cancel  ", 530, 650, 100, 30)

; Create the first child window that is implemented into the main GUI
$child1 = GUICreate("", 940, 547, 25, 82, BitOR($WS_CHILD, $WS_TABSTOP), -1, $main_GUI)
$child_tab = GUICtrlCreateTab(5, 5, 929, 539)

$child11tab = GUICtrlCreateTabItem("::              Win 7             ::")
;GUICtrlCreateInput("Username", 20, 70, 100, 25)
UI_Scenario_Products(0)

$child12tab = GUICtrlCreateTabItem("::              Win 8             ::")
   UI_Scenario_Products(1)
$child13tab = GUICtrlCreateTabItem("::              Win 8.1             ::")
   UI_Scenario_Products(2)
$child14tab = GUICtrlCreateTabItem("::              Win 10             ::")
   UI_Scenario_Products(3)
$child15tab = GUICtrlCreateTabItem("::              Win 10.1             ::")
   UI_Scenario_Products(4)

GUICtrlCreateTabItem("")

GUISetState()

; Create the second child window that is implemented into the main GUI
$child2 = GUICreate("", 940, 355, 25, 82, BitOR($WS_CHILD, $WS_TABSTOP), -1, $main_GUI)
;$listview2      = GUICtrlCreateListView("Col1|Col2",10,10,910,315,-1,$WS_EX_CLIENTEDGE)
$child_tab = GUICtrlCreateTab(5, 5, 930, 335)
$child11tab = GUICtrlCreateTabItem("::          Win 7     ::")
$child12tab = GUICtrlCreateTabItem("::          Win 8         ::")
$child13tab = GUICtrlCreateTabItem("::          Win 8.1         ::")
$child14tab = GUICtrlCreateTabItem("::          Win 10         ::")
$child15tab = GUICtrlCreateTabItem("::          Win 2K8 R2         ::")
$child11tab = GUICtrlCreateTabItem("::          Win 2012 R2         ::")
$child12tab = GUICtrlCreateTabItem("::          Win 2016         ::")



; Switch back the main GUI and create the tabs
GUISwitch($main_GUI)
$main_tab = GUICtrlCreateTab(10, 50, 970, 590)
$child1tab = GUICtrlCreateTabItem("                                                                         32 Bit                                                                        ")
$child2tab = GUICtrlCreateTabItem("                                                                         64 Bit                                                                        ")
GUICtrlCreateTabItem("")
GUICtrlSetBkColor(-1, 0xFFFFCC)

GUISetState()
Dim $sMenutext

While 1
    $msg = GUIGetMsg(1)

    Switch $msg[0]
        Case $GUI_EVENT_CLOSE, $cancel_button
            ExitLoop
        Case $ok_button
            $hOutFile = FileOpen('products.txt', $FO_OVERWRITE)
            $DisplayCreds =" "
            For $iTab = 0 To 4
                $AllCred = ""
                 For $iCreds = 0 To 2
                       $AllCred = GUICtrlRead($idCreds[$iTab][$iCreds],  $GUI_READ_EXTENDED)
                       $AllCred = " " + $AllCred
                 Next

                $FullScenario = ""
                For $iScenarios = 0 To 9
                   $PPs =""
                    For $iProducts = 0 To 7
                        If Not(GUICtrlRead($idProduct[$iTab][$iScenarios][$iProducts]) = "") Then
                           $PPs =  $PPs & "~" & GUICtrlRead($idProduct[$iTab][$iScenarios][$iProducts])
                        EndIf
                     Next
                     $FullScenario = $FullScenario & @TAB & StringTrimLeft($PPs, 1)
               Next

               If Not(StringStripWS($FullScenario, $STR_STRIPLEADING + $STR_STRIPTRAILING) = "") Then
                  FileWriteLine($hOutFile, "|" & StringStripWS($FullScenario, $STR_STRIPLEADING + $STR_STRIPTRAILING) & "|")
               EndIf
            Next

            FileClose($hOutFile)
        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

Func UI_Scenario_Products($iTab)
    $Top = 150
    $Left = 120
    $CredLeft = 200
      For $iCreds = 0 To 2
            $iLabel[$iTab][$iCreds] = GUICtrlCreateLabel("Parameter" & $iCreds + 1, $CredLeft, 70, 100, 25)
            $idCreds[$iTab][$iCreds] = GUICtrlCreateInput("", $CredLeft, 90, 100, 25)
            $InputSeletectItem = GUICtrlSetData($idCreds[$iTab][$iCreds], "", "")
            $CredLeft = $CredLeft + 210
      Next


    For $iScenarios = 0 To 9
        $idScenario = GUICtrlCreateLabel("Scenario - " & $iScenarios + 1, 20, $Top, 100, 25)
        For $iProducts = 0 To 7
            $idProduct[$iTab][$iScenarios][$iProducts] = GUICtrlCreateCombo("", $Left, $Top, 100, 25)
            $ComboSeletectItem = GUICtrlSetData($idProduct[$iTab][$iScenarios][$iProducts], "AAA 88 RP1|AAA 88 RP2|AAA 88 RP3|AAA 88 RP4|AAA 88 RP5|AAA 88 RP6|AAA 88 RP7|AAA 88 RP8|BBB 88 RP1|BBB 88 RP2|BBB 88 RP3", "")

            $Left = $Left + 100
        Next
        $Top = $Top + 35
        $Left = 120
    Next
EndFunc   ;==>UI_Scenario_Products

 


Neil

Share this post


Link to post
Share on other sites

May be like this:

#include <ColorConstants.au3>
#include <GUIConstants.au3>
#include <FileConstants.au3>
#include <StringConstants.au3>
#include <MsgBoxConstants.au3>

Global $main_GUI, $ok_button, $cancel_button
Global $idProduct[5][10][8]
Global $idCreds[5][3]
;Global $iLabel[5][3]

; This window has 2 ok/cancel-buttons
$main_GUI = GUICreate("Planner", 1000, 700, -1, -1)
$ok_button = GUICtrlCreateButton("  OK  ", 400, 650, 100, 30)
$cancel_button = GUICtrlCreateButton("  Cancel  ", 530, 650, 100, 30)

; Create the first child window that is implemented into the main GUI
$child1 = GUICreate("", 940, 547, 25, 82, BitOR($WS_CHILD, $WS_TABSTOP), -1, $main_GUI)
$child_tab = GUICtrlCreateTab(5, 5, 929, 539)

$child11tab = GUICtrlCreateTabItem("::              Win 7             ::")
;GUICtrlCreateInput("Username", 20, 70, 100, 25)
UI_Scenario_Products(0)

$child12tab = GUICtrlCreateTabItem("::              Win 8             ::")
UI_Scenario_Products(1)
$child13tab = GUICtrlCreateTabItem("::              Win 8.1             ::")
UI_Scenario_Products(2)
$child14tab = GUICtrlCreateTabItem("::              Win 10             ::")
UI_Scenario_Products(3)
$child15tab = GUICtrlCreateTabItem("::              Win 10.1             ::")
UI_Scenario_Products(4)

GUICtrlCreateTabItem("")

GUISetState()

; Create the second child window that is implemented into the main GUI
$child2 = GUICreate("", 940, 355, 25, 82, BitOR($WS_CHILD, $WS_TABSTOP), -1, $main_GUI)
;$listview2      = GUICtrlCreateListView("Col1|Col2",10,10,910,315,-1,$WS_EX_CLIENTEDGE)
$child_tab = GUICtrlCreateTab(5, 5, 930, 335)
$child11tab = GUICtrlCreateTabItem("::          Win 7     ::")
$child12tab = GUICtrlCreateTabItem("::          Win 8         ::")
$child13tab = GUICtrlCreateTabItem("::          Win 8.1         ::")
$child14tab = GUICtrlCreateTabItem("::          Win 10         ::")
$child15tab = GUICtrlCreateTabItem("::          Win 2K8 R2         ::")
$child11tab = GUICtrlCreateTabItem("::          Win 2012 R2         ::")
$child12tab = GUICtrlCreateTabItem("::          Win 2016         ::")



; Switch back the main GUI and create the tabs
GUISwitch($main_GUI)
$main_tab = GUICtrlCreateTab(10, 50, 970, 590)
$child1tab = GUICtrlCreateTabItem("                                                                         32 Bit                                                                        ")
$child2tab = GUICtrlCreateTabItem("                                                                         64 Bit                                                                        ")
GUICtrlCreateTabItem("")
GUICtrlSetBkColor(-1, 0xFFFFCC)
GUISetState()
Dim $sMenutext

While 1
    $msg = GUIGetMsg(1)

    Switch $msg[0]
        Case $GUI_EVENT_CLOSE, $cancel_button
            ExitLoop
        Case $ok_button
            $hOutFile = FileOpen('products.txt', $FO_OVERWRITE)
            $DisplayCreds = " "
            For $iTab = 0 To 4
                $AllCred = ""
                For $iCreds = 0 To 2
                    ;$AllCred = GUICtrlRead($idCreds[$iTab][$iCreds],  $GUI_READ_EXTENDED)
                    $AllCred &= GUICtrlRead($idCreds[$iTab][$iCreds]) ;<===
                    ;$AllCred = " " + $AllCred
                    $AllCred &= " "
                Next
                FileWriteLine($hOutFile, $AllCred)
                $FullScenario = ""
                For $iScenarios = 0 To 9
                    $PPs = $iScenarios&": "
                    For $iProducts = 0 To 7
                        If Not (GUICtrlRead($idProduct[$iTab][$iScenarios][$iProducts]) = "") Then
                            $PPs = $PPs & "~" & GUICtrlRead($idProduct[$iTab][$iScenarios][$iProducts])
                        EndIf
                    Next
                    $FullScenario = $FullScenario & @TAB & StringTrimLeft($PPs, 1)
                Next

                If Not (StringStripWS($FullScenario, $STR_STRIPLEADING + $STR_STRIPTRAILING) = "") Then
                    FileWriteLine($hOutFile, "|" & StringStripWS($FullScenario, $STR_STRIPLEADING + $STR_STRIPTRAILING) & "|")
                EndIf
            Next

            FileClose($hOutFile)
        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

Func UI_Scenario_Products($iTab)
    $Top = 150
    $Left = 120
    $CredLeft = 200
    For $iCreds = 0 To 2
        ;$iLabel[$iTab][$iCreds] = GUICtrlCreateLabel("Parameter" & $iCreds + 1, $CredLeft, 70, 100, 25)
        GUICtrlCreateLabel("Parameter" & $iCreds + 1, $CredLeft, 70, 100, 25, $SS_LEFT) ;<===
        $idCreds[$iTab][$iCreds] = GUICtrlCreateInput("", $CredLeft, 90, 100, 25)
        ;$InputSeletectItem = GUICtrlSetData($idCreds[$iTab][$iCreds], "", "")
        $CredLeft = $CredLeft + 210
    Next


    For $iScenarios = 0 To 9
        $idScenario = GUICtrlCreateLabel("Scenario - " & $iScenarios + 1, 20, $Top, 100, 25)
        For $iProducts = 0 To 7
            $idProduct[$iTab][$iScenarios][$iProducts] = GUICtrlCreateCombo("", $Left, $Top, 100, 25)
            ;$ComboSeletectItem = GUICtrlSetData($idProduct[$iTab][$iScenarios][$iProducts], "AAA 88 RP1|AAA 88 RP2|AAA 88 RP3|AAA 88 RP4|AAA 88 RP5|AAA 88 RP6|AAA 88 RP7|AAA 88 RP8|BBB 88 RP1|BBB 88 RP2|BBB 88 RP3", "")
            GUICtrlSetData($idProduct[$iTab][$iScenarios][$iProducts], "AAA 88 RP1|AAA 88 RP2|AAA 88 RP3|AAA 88 RP4|AAA 88 RP5|AAA 88 RP6|AAA 88 RP7|AAA 88 RP8|BBB 88 RP1|BBB 88 RP2|BBB 88 RP3", "")
            $Left = $Left + 100
        Next
        $Top = $Top + 35
        $Left = 120
    Next
EndFunc   ;==>UI_Scenario_Products

If further help needed, please post a Textfile wich shows the design you want.

Share this post


Link to post
Share on other sites

Thanks you again AutoBert. Yes, I wanted almost the same, may be few changes here and there which I guess I will be able to manage.

Thanks a million :)


Neil

Share this post


Link to post
Share on other sites

Glad i could show the way.

Share this post


Link to post
Share on other sites

:):):)


Neil

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