Jump to content

2nd combobox input data weird


Recommended Posts

the 2nd combobox data seems to be the label????

what gives anyone? and it does not run in debugger - why also?

#include <ComboConstants.au3>
#include <Excel.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <GDIPlus.au3>
Local $widthCell, $msg, $iOldOpt

Dim $sPathAUT = 'C:\Data\AUT.xls'
Dim $sPathUSERS = 'C:\Data\USERS.xls'
Dim $oExcel1 = _ExcelBookOpen($sPathAUT, 0)
Dim $oExcel2 = _ExcelBookOpen($sPathUSERS, 0)
Dim $aArrayAUT = _ExcelReadSheetToArray($oExcel1)
Dim $aArrayUSER = _ExcelReadSheetToArray($oExcel2)
_ExcelBookClose($oExcel1, 0)
_ExcelBookClose($oExcel2, 0)
Dim $sStr = ''

For $i = 1 To $aArrayAUT[0][0]
    For $j = 1 To $aArrayAUT[0][1]
        If $aArrayAUT[$i][$j] <> "" Then $sStr &= $aArrayAUT[$i][$j] & '|'
    Next
Next

$sStr = StringTrimRight($sStr, 1)
Dim $sStr2 = ''

For $i = 1 To $aArrayUSER[0][0]
    For $j = 1 To $aArrayUSER[0][1]
        If $aArrayUSER[$i][$j] <> "" Then $sStr2 &= $aArrayUSER[$i][$j] & '|'
    Next
Next

$sStr2 = StringTrimRight($sStr2, 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Rundata Selection Criteria", 633, 647, 193, 125)
GUISetBkColor(0xA6CAF0)
$Label1 = GUICtrlCreateLabel("Please Select Application to test", 16, 24, 216, 18)
GUICtrlSetFont(-1, 9, 800, 0, "Verdana")
GUICtrlSetColor(-1, 0x000080)
$AUT = GUICtrlCreateCombo("AUT", 32, 56, 145, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Verdana")
GUICtrlSetData(-1, $sStr )
$USER = GUICtrlCreateCombo("USER", 280, 56, 145, 25)
$Label2 = GUICtrlCreateLabel("Please Select User", 288, 24, 128, 18)
GUICtrlSetFont(-1, 9, 800, 0, "Verdana")
GUICtrlSetData(-1, $sStr2 )
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Label1
        Case $AUT
        Case $USER
    EndSwitch
WEnd
Edited by joeloyzaga
Link to comment
Share on other sites

GUICtrlSetData(-1, $sStr2 )oÝ÷ Ù(hºW[y«­¢+ÙU%
ÑɱMÑÑ ÀÌØíUMH°ÀÌØíÍMÑÈȤ

Or put it before creating the label because -1 refers to the previous created control.

ok it works now but how do I get the selected values???

#include <ComboConstants.au3>
#include <Excel.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <GDIPlus.au3>
Local $widthCell, $msg, $iOldOpt

Dim $sPathAUT = 'C:\Data\AUT.xls'
Dim $sPathUSERS = 'C:\Data\USERS.xls'
Dim $oExcel1 = _ExcelBookOpen($sPathAUT, 0)
Dim $oExcel2 = _ExcelBookOpen($sPathUSERS, 0)
Dim $aArrayAUT = _ExcelReadSheetToArray($oExcel1)
Dim $aArrayUSER = _ExcelReadSheetToArray($oExcel2)
_ExcelBookClose($oExcel1, 0)
_ExcelBookClose($oExcel2, 0)
Dim $sStr = ''

For $i = 1 To $aArrayAUT[0][0]
    For $j = 1 To $aArrayAUT[0][1]
        If $aArrayAUT[$i][$j] <> "" Then $sStr &= $aArrayAUT[$i][$j] & '|'
    Next
Next

$sStr = StringTrimRight($sStr, 1)
Dim $sStr2 = ''

For $i = 1 To $aArrayUSER[0][0]
    For $j = 1 To $aArrayUSER[0][1]
        If $aArrayUSER[$i][$j] <> "" Then $sStr2 &= $aArrayUSER[$i][$j] & '|'
    Next
Next

$sStr2 = StringTrimRight($sStr2, 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Rundata Selection Criteria", 633, 647, 193, 125)
$Group1 = GUICtrlCreateGroup("User Profile Selection", 8, 0, 585, 105)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
GUICtrlCreateGroup("", -99, -99, 1, 1)




GUISetBkColor(0xA6CAF0)
$Label1 = GUICtrlCreateLabel("Please Select Application to test", 16, 24, 216, 18)
GUICtrlSetFont(-1, 9, 800, 0, "Verdana")
GUICtrlSetColor(-1, 0x000080)
$AUT = GUICtrlCreateCombo("AUT", 32, 56, 75, 25)
GUICtrlSetFont(-1, 8, 400, 0, "Verdana")
GUICtrlSetData(-1, $sStr )

$Label2 = GUICtrlCreateLabel("Please Select User", 288, 24, 128, 18)
GUICtrlSetFont(-1, 9, 800, 0, "Verdana")
GUICtrlSetColor(-1, 0x000080)
$USER = GUICtrlCreateCombo("USER", 280, 56, 115, 25)
GUICtrlSetFont(-1, 9, 400, 0, "Verdana")
GUICtrlSetData(-1, $sStr2 )

GUISetState()
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Label1
        Case $AUT
            MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($AUT)), 10)
            MsgBox(1,"got AUT", $nMsg)
        Case $USER
    EndSwitch
WEnd
Link to comment
Share on other sites

Just one call to GUICtrlRead:

MsgBox(0x40, 'Combo Box Items', GUICtrlRead($AUT))

or $nMsg. If the message was posted from $AUT then $nMsg = $AUT.

Thanks - perfect

Now I'm going to use the selected items to display all, the other items in the profile as input boxes and use the same gui to do so - is that possible?

Link to comment
Share on other sites

Selected items? of combo box?

Anyway, you don't have to use the same GUI window. You can make it a little shorter and create a new GUI window after the user has selected the items and build the new GUI with it's new input boxes according to the number of selections which you may want to explain a little bit. ;]

Link to comment
Share on other sites

Selected items? of combo box?

Anyway, you don't have to use the same GUI window. You can make it a little shorter and create a new GUI window after the user has selected the items and build the new GUI with it's new input boxes according to the number of selections which you may want to explain a little bit. ;]

Currently I am getting the Application I want test and the users's name. Ialso need to get the environment (another combo box)

From these I can open the excel spreadsheet that contains his/her default profile for the automation run. This profile I will output to the gui, allowing the user to modify it prior to the run. Then I will ask them to select script names(multiple selections so I guess its some sort of a selectable list view?) From this I have all I need for the automation run. I lastly prompt them for the time of day to do this run.

Is there a way to group the functions within th e same gui or just re-display a slightly bigger gui with the selections/comboboxes I need until ok button is pressed? Can I display error messages somewhere if the selections don't make sense?

Joe

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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