dushkin Posted March 9, 2014 Posted March 9, 2014 (edited) Hi all, I need your help to learn how can I implement the data structure as described in the attachment Thanks! Edited March 9, 2014 by dushkin
Moderators Melba23 Posted March 9, 2014 Moderators Posted March 9, 2014 dushkin,Looks like an ini file will suffice: [Item 1] Key=Val Key=Val Key=Val Key=Val [Item 2] Key=Val Key=Val [Item 3] Key=Val Key=Val Key=ValM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
dushkin Posted March 9, 2014 Author Posted March 9, 2014 Thanks Melba. But I need to build this structure at run time, and not to offline. I am reading the data from a file.
Moderators Melba23 Posted March 9, 2014 Moderators Posted March 9, 2014 dushkin,I see. Then perhaps an array of arrays: ; 3 "Item"s $aData_Outer[4] ; Now add the "Key/Val" pairs as arrays held within each item $aData_Outer[1] = $aData_Inner_1[5][2] ;$aData_inner_1[1][0] = Key1 $aData_inner_1[1][1] = Value1 $aData_inner_1[2][0] = Key2 $aData_inner_1[2][1] = Value2 $aData_inner_1[3][0] = Key3 $aData_inner_1[3][1] = Value3 $aData_inner_1[4][0] = Key4 $aData_inner_1[5][1] = Value4 ; $aData_Outer[2] = $aData_Inner_2[3][2] $aData_inner_2[1][0] = Key1 $aData_inner_2[1][1] = Value1 $aData_inner_2[2][0] = Key2 $aData_inner_2[2][1] = Value2 ; $aData_Outer[3] = $aData_Inner_1[4][2] $aData_inner_3[1][0] = Key1 $aData_inner_3[1][1] = Value1 $aData_inner_3[2][0] = Key2 $aData_inner_3[2][1] = Value2 $aData_inner_3[3][0] = Key3 $aData_inner_3[3][1] = Value3M23; Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Gianni Posted March 9, 2014 Posted March 9, 2014 could you post a "sample" of the data you need to load from the file? Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
dushkin Posted March 9, 2014 Author Posted March 9, 2014 (edited) Melba - Thanks. I will considerate it. Pinco - suppose I want to read from a file that holds the list of all car vendors that sells in a certain country, and then the models and their prices. So, for example: Honda Civic-50000 Toyota Corolla - 40000 Yaris - 25000 Hyundai i30-30000 i35-40000 etc. The number of the vendors and the models are unknown, unless I perform 2 passes on the file (and I prefer not to) Thanks. Edited March 9, 2014 by dushkin
dushkin Posted March 9, 2014 Author Posted March 9, 2014 (edited) Thanks Firefox. It is an HTML. The values are not in english, and even not in latin charachters :-) Will it still be helpfull? Aren't the concept and the example clear enough? Edited March 9, 2014 by dushkin
FireFox Posted March 9, 2014 Posted March 9, 2014 (edited) An array example was given to you, which is exactly what you're looking for. For the unknown count, use ReDim if necessary with a step; but since it's a html, I'm not sure it will be necessary. I asked you this if you want us to build you a full working example. Br, FireFox. Edited March 9, 2014 by FireFox
dushkin Posted March 9, 2014 Author Posted March 9, 2014 All, thank you for your kind help. Mmmm, If I will just send the html file, and I will specify the tags that surround the values I need - will it suffice?
FireFox Posted March 9, 2014 Posted March 9, 2014 and I will specify the tags that surround the values I need - will it suffice? Sure
Gianni Posted March 9, 2014 Posted March 9, 2014 Melba - Thanks. I will considerate it. Pinco - suppose I want to read from a file that holds the list of all car vendors that sells in a certain country, and then the models and their prices. So, for example: Honda Civic-50000 Toyota Corolla - 40000 Yaris - 25000 Hyundai i30-30000 i35-40000 etc. The number of the vendors and the models are unknown, unless I perform 2 passes on the file (and I prefer not to) Thanks. something like this could do #include <File.au3> #include <array.au3> Local $output[1][2], $x = 0, $i Local $aArray _FileReadToArray(".\data.txt", $aArray) ; _ArrayDisplay($aArray) For $i = 1 To $aArray[0] ; check for empty lines If StringStripWS(StringStripCR($aArray[$i]), 7) <> "" Then If Not StringInStr($aArray[$i], "-") Then ReDim $output[UBound($output)][$x + 2] $output[0][$x] = StringStripWS($aArray[$i], 3) $x += 2 ; will be next column $y = 1 Else If $y = UBound($output) Then ReDim $output[UBound($output) + 1][UBound($output, 2)] EndIf $temp = StringSplit($aArray[$i], "-", 2) $output[$y][$x - 2] = StringStripWS($temp[0], 3) $output[$y][$x - 1] = StringStripWS($temp[1], 3) $y += 1 EndIf EndIf Next _ArrayDisplay($output) anyway, if data is on an internet site, then you could grab data directly from the web page using _ie* function instead of pass through disk files Bye Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
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