madmorgan Posted February 15, 2010 Posted February 15, 2010 hello all, i have a few INI files holding information like this. file 1 [title01] ........ ....... [title02] ...... ...... file 2 [info01] ....... ....... [info02] ...... ...... my question is how can i search throw all these files for sertion bits of information. so if i want to load all of [title01] and [info01] at the same time to a gui and then lator load [title88] and [info88]. i have looked in the help file and i cant work it out so if any one knows please help me many thanks.
Moderators Melba23 Posted February 15, 2010 Moderators Posted February 15, 2010 madmorgan,If you want read a whole section at a time, then IniReadSection is the command to use. You get all of the key=value pairs into an array which you can then search or display as you wish in your GUI. M23 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
madmorgan Posted February 15, 2010 Author Posted February 15, 2010 so if i used inireadselection to look of all sections from each file and that loads to an arry so how would i search throw that arry??? for somthing like 88 for [title88]?? hop i make sense.
GEOSoft Posted February 15, 2010 Posted February 15, 2010 (edited) http://dundats.mvps.org/help/html/libfunctions/_ArraySearch.htm Carefuly study the parameters paying particular attention to $iPartial and $iSubItem Edited February 15, 2010 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
Moderators Melba23 Posted February 15, 2010 Moderators Posted February 15, 2010 madmorgan, IniReadSection will only read the section you specify. i want to load all of [title01] and [info01]To read these sections you would do something like this: $a_title01 = IniReadSection ( "file1", "title01" ) $a_info01 = IniReadSection ( "file2", "info01" ) You will now have 2 arrays holding all of the key-value pairs from those 2 sections. You can use _ArraySearch to look for the specific key or value you want within them. M23 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
madmorgan Posted February 15, 2010 Author Posted February 15, 2010 thanks for the help guys but here is a image of what i want to try to get done hop this helps with what i want and might help you all under stand what i want to do better.
GEOSoft Posted February 15, 2010 Posted February 15, 2010 It would help even more if you gave us at least one example of the data structure used in the ini files. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
madmorgan Posted February 15, 2010 Author Posted February 15, 2010 ok here are two files i have so far. if titleo1 is clicked then i want the information from info01 to link to it. Title.ini [title01] Borderlands [title02] avatar [title03] pandorum Dec.ini [dec01] infomation comming soon [info02] information comming soon [info03] information comming soon
GEOSoft Posted February 15, 2010 Posted February 15, 2010 ok here are two files i have so far. if titleo1 is clicked then i want the information from info01 to link to it. Title.ini [title01] Borderlands [title02] avatar [title03] pandorum Dec.ini [dec01] infomation comming soon [info02] information comming soon [info03] information comming soon Therein lies the problem with using ini functions. That is not a properly structured Ini file. This could really all be written in a single file or use a single Ini file and a flat text file (as you have now for the Dec.ini file) in which case prudent use of StringRegExp() will work nicely. For Title.ini [Titles] title1=Borderlands title2=avatar title3=pandorumThen you could use IniReadSection($sIni, "titles") $sIni = "Title.ini" $aResults = IniReadSection($sIni, "Titles") Dec.txt [borderlands] infomation comming soon [avatar] information comming soon [pandorum] information comming soon To bring it all together $sIni = "Title.ini" $sText = FileRead("dec.txt") $aResults = IniReadSection($sIni, "Titles") $sStr = FileRead($ ;; All of the following can be replaced depending on what you want to do with the data. I'm using a loop to demonstrate it For $i = 1 To Ubound($aResults) -1 $sResult = StringRegExpReplace($sText, "(?i)(?s).*\[" & $aResults[$i][1] & "\v+(.*?)(?:\[|\z).*", "$1") MsgBox(0, "result", $sResult) Next Note: I don't have time to test that RegExReplace but I think it's close and probably works as is George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
GEOSoft Posted February 15, 2010 Posted February 15, 2010 any one got any idears?Please don't bump threads. Sometrimes you just have to wait patiently for a reply. Read my signature in respect to bumping George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
madmorgan Posted February 15, 2010 Author Posted February 15, 2010 it was one of my own comments i removed.
GEOSoft Posted February 15, 2010 Posted February 15, 2010 it was one of my own comments i removed.Did you try creating the files as I suggested and then running the code? George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
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