Joep86 Posted February 5, 2016 Posted February 5, 2016 Hi, I just started recently with AutoIT and I am trying to make two dropdownlists where the selectable values of the second dropdownlist will be depending on what is selected on the first one. For example: Dropdown 1 Dropdown 2 xxx => 01-15 ("01" , "02" ,"03" , ...) yyy => a - f ("a" , "b" ,"c" ,"d" ,"e" ,"f" ) zzz => "new", "old", "spare" I started with this code that I've found in this Forum: #include <GUIConstantsEx.au3> ; Here is the array Global $aArray[6] = ["SORT", "PCM", "UNIF", "KKE", "GMS", "CDY"] ; And here we get the elements into a list $sList = "" For $i = 0 To UBound($aArray) - 1 $sList &= "|" & $aArray[$i] Next ; Create a GUI #include <GUIConstantsEx.au3> $hGUI = GUICreate("DropDown", 500, 500) ; Create the combo $hCombo = GUICtrlCreateCombo("", 10, 10, 200, 20) ; And fill it GUICtrlSetData($hCombo, $sList) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Any idea how to start on this one... thanks upfront
AutoBert Posted February 5, 2016 Posted February 5, 2016 here a small demo with 2 comboboxes: expandcollapse popup#Include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <array.au3> #include <File.au3> Const $sCSV = @AppDataDir & "\2cbo.CSV" Const $sElect = "bitte auswählen" Dim $a_sCSV, $aSplit, $scboChr = "" _FileReadToArray($sCSV,$a_sCSV) Dim $aCSV[$a_sCSV[0]][2] for $i = 1 to UBound($a_sCSV) - 1 ConsoleWrite($i & $a_sCSV[$i] & @CRLF) $aSplit = StringSplit($a_sCSV[$i],";") if not StringInStr($scboChr,$aSplit[1]) Then $scboChr &= $aSplit[1] & "|" $aCSV[$i-1][0] = $aSplit[1] $aCSV[$i-1][1] = $aSplit[2] Next ConsoleWrite($scboChr & @CRLF) $hGui = GUICreate("2 Comboboxen aus 1er CSV ", 250, 120, 302, 218) $hcboChr = GUICtrlCreateCombo($sElect, 8, 8, 200, 25) GUICtrlSetData(-1,$scboChr) $hcboChrNr = GUICtrlCreateCombo("",8,35,200,25) $hbtnExit = GUICtrlCreateButton("Be&enden", 8, 65) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $hbtnExit Exit Case $hcboChr $sVal = GUICtrlRead($hcboChr) if $sVal <> $sElect Then $aSplit = _ArrayFindAll($aCSV,$sVal,0,0,True,True,0) GUICtrlSetData($hcboChrNr,"") $scboChr = "" for $i = 0 to UBound($aSplit) - 1 $scboChr &= $aCSV[$aSplit[$i]][1] & "|" Next ConsoleWrite($scboChr & @CRLF) GUICtrlSetData($hcboChrNr,$scboChr) _GUICtrlComboBox_SetCurSel($hcboChrNr, 0) EndIf EndSwitch WEnd And here is the csv: Auto;Felgen Werkzeug;BitSätze Werkzeug;Schraubenschlüssel Auto;Reifen Zubehör;Enteiserspray which must be in @AppDataDir.
Joep86 Posted February 5, 2016 Author Posted February 5, 2016 Hi , Thanks a lot ! Do you have any idea how I could the values not in csv but xml format ? and in stead of typing full xxx;01 / xxx;02 / xxx;03 /... that I can say range for xxx is from 01 to 05 for example
kylomas Posted February 5, 2016 Posted February 5, 2016 Joep86, Please post an example of your XML file. 6 hours ago, Joep86 said: and in stead of typing full xxx;01 / xxx;02 / xxx;03 /... Typing it where, for what? kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Joep86 Posted February 6, 2016 Author Posted February 6, 2016 Hi , I would like to read out parameters for a dropdown list from a xml file ? in example above it's done through a csv file , how is it possible to do this then with xml ? let say I have a parameter like this in the xml file : <ScanP_ProcessNameKill> -<Input> <string>SC{0:n8}.{1:n}.</string> </Input> <OutPut>{0}.{1:000}</OutPut> </ScanP_ProcessNameKill>>>
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now