Sign in to follow this  
Followers 0
madmorgan

Questinon about INI files

12 posts in this topic

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.

Share this post


Link to post
Share on other sites



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. :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

http://dundats.mvps.org/help/html/libfunctions/_ArraySearch.htm

Carefuly study the parameters paying particular attention to $iPartial and $iSubItem

Edited 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!"

Share this post


Link to post
Share on other sites

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. :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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.

post-54629-12662533533056_thumb.png

Share this post


Link to post
Share on other sites

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!"

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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=pandorum

Then 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!"

Share this post


Link to post
Share on other sites

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!"

Share this post


Link to post
Share on other sites

it was one of my own comments i removed.

Share this post


Link to post
Share on other sites

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!"

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