rootx

IniReadSectionNames problem? [SOLVED]

12 posts in this topic

#1 ·  Posted (edited)

The path are cutted! maybe double [] in the path generated the error.

Example:
 

[I:\aaa\cc\aa vv vv vv (dd).txt]
name=aa vv vv vv (dd).txt
[I:\ffff\ffff\ffff ffff ffff ffff  [ffff]\ffff\ffff.txt]
name=ffff.txt

$ini = IniReadSectionNames(@ScriptDir&"\my.ini")
_ArrayDisplay($ini)
for $x = 1 to UBound($ini)-1
ConsoleWrite($ini[$x]&@CRLF)
Next

 

Edited by rootx
Amended title

Share this post


Link to post
Share on other sites



#2 ·  Posted

@rootx if you believe you have found a bug, please use the Bug Tracker section to report it.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

11 minutes ago, JLogan3o13 said:

@rootx if you believe you have found a bug, please use the Bug Tracker section to report it.

I'm not sure why [] is the standard ... and the solution is to skip the brackets inside the path string. But I'm not sure if you can, or you need to clean the name of the folder or change approach.

 

Edited by rootx

Share this post


Link to post
Share on other sites

#4 ·  Posted

Are you sure that square brackets are allowed in a section name?
Do INI-files support escape characters or encoded characters?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

for example it can happen that people write of the strange path as C: \ name [IBIS 001] 2017. But ini standard are

[C: \ name [IBIS 001] 2017\file.txt]

name=IBIS 001

years=2017

etc...

 

Edited by rootx

Share this post


Link to post
Share on other sites

#6 ·  Posted

Just over a month ago, I created a viewer (ASCII Checker) to help with determining INI entry issues.

It might be of some help to you, and can be found here.

There is also a link in the quoted section, to a Wikipedia article about INI files and escape characters.

1 person likes this

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

#7 ·  Posted

rootx,

You will have to do some pre/post-processing of the section names if you think there might be [ ] characters in the section name:

#include <Array.au3>

$sIniFile = "Test.ini"

$sPath = "C: \ name [IBIS 001] 2017\file.txt"

$sEscPath = StringReplace(StringReplace($sPath, "[", "\5B"), "]", "\5D")

IniWrite($sIniFile, $sEscPath, "Key", "Value")

$aSections = IniReadSectionNames($sIniFile)

For $i = 1 To $aSections[0]
    $aSections[$i]  = StringReplace(StringReplace($aSections[$i], "\5B", "["), "\5D", "]")
Next

_ArrayDisplay($aSections, "", Default, 8)

And please do not be so quick to declare a bug - best ask first next time.

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

#8 ·  Posted

Thx, But the question is... if you have this ini file you are not able to read this file.

[C: \ name [5BIBIS 001] 5D 2017\file.txt]
Key=Value

#include <Array.au3>

$sIniFile = "Test.ini"

$aSections = IniReadSectionNames($sIniFile)

For $i = 1 To $aSections[0]
    $aSections[$i]  = StringReplace(StringReplace($aSections[$i], "\5B", "["), "\5D", "]")
    ConsoleWrite($aSections[$i])
Next

_ArrayDisplay($aSections, "", Default, 8)

And how can you open this file C: \ name [5BIBIS 001 with iniread?

Share this post


Link to post
Share on other sites

#9 ·  Posted

Thx.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

rootx,

You will need to read the ini file into an array, preprocess the [ & ] characters which are not bounding the section and then rewrite it - something like this:

#include <Array.au3>
#include <File.au3>

$sPath = "C: \ name [IBIS 001] 2017\file.txt"

$sIniFile = "Test.ini"

$hFile = FileOpen($sIniFile, $FO_OVERWRITE)
FileWrite($hFile, "[" & $sPath & "]" & @CRLF & "Key=Value")
FileClose($hFile)

Global $aLines
_FileReadToArray($sIniFile, $aLines)

_ArrayDisplay($aLines, "Original ini content", Default, 8)

For $i = 1 To $aLines[0]
    ; Look for the section names
    If StringLeft($aLines[$i], 1) = "[" Then
        ; Extract the sectionname from within the [ & ]
        $sSectionName = StringTrimLeft(StringtrimRight($aLines[$i], 1), 1)
        ; Escape any [ & ] and rewrit ewith the external [ & ]
        $aLines[$i] = "[" & StringReplace(StringReplace($sSectionName, "[", "\5B"), "]", "\5D") & "]"
    EndIf
Next
; Now rewrite the escaped ini file
_FileWriteFromArray($sIniFile, $aLines, 1)

; Now read it
$aSections = IniReadSectionNames($sIniFile)

For $i = 1 To $aSections[0]
    $aSections[$i]  = StringReplace(StringReplace($aSections[$i], "\5B", "["), "\5D", "]")
Next

_ArrayDisplay($aSections, "Section names from ini", Default, 8)

M23

Edited by Melba23
Typos
1 person likes this

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

#11 ·  Posted

#include <Array.au3>
#include <File.au3>
$sIniFile = "Test.ini"

DirCreate(@ScriptDir&"\name [5BIBIS 001] 5D 2017")
FileWrite(@ScriptDir&"\name [5BIBIS 001] 5D 2017\file.txt","xxxx")


$file = _FileListToArrayRec(@ScriptDir,"*.txt",1,1,1,2)


For $s = 1 to UBound($file)-1
    IniWrite($sIniFile, $file[$s],"name",StringRegExpReplace($file[$s], "^.*\\(.*)$", "$1"))
Next

$aSections = IniReadSectionNames($sIniFile)

For $i = 1 To $aSections[0]
    $aSections[$i]  = StringReplace(StringReplace($aSections[$i], "\5B", "["), "\5D", "]")
    ConsoleWrite("WRONG "&$aSections[$i] & "  WRONG " & $aSections[$i]&@CRLF)
Next

_ArrayDisplay($aSections, "", Default, 8)

Thx, but at the same time i have writted!! I try your script thx again.

Share this post


Link to post
Share on other sites

#12 ·  Posted

Anyway Thx guys, special thx Melba23 4your time.

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

  • Similar Content

    • rootx
      By rootx
      HI friends, I would order this array, starting from the name of the last folder.
      My situation...
      My file ini
      [C:\program\room\p\file.exe]
      [E:\program\room\a\file.exe]
      [D:\program\room\m\file.exe]
      Goal.... sort by last folder!  a-m-p
       Any Idea, THX
      $ini = @ScriptDir&"\ini.ini" $aArrays = IniReadSectionNames($ini) For $i = 1 To UBound($aArrays)-1 ConsoleWrite($aArrays[$i]&@CRLF) ConsoleWrite(StringRegExp($aArrays[$i],'.*\\(.*)\\',1)[0]&@CRLF) Next  
    • zvvyt
      By zvvyt
      Hello once again!
      First of all I must say I'm not sure if I posted this in the correct forum, as this contains a GUI and such, but the problem ain't relevant with the GUI.
      I've encountered a little problem with the IniReadSectionNames-function.
      I'm making a script w/ a GUI which helps you create a ListView.
      At the end you'll be able to save the information in an .ini-file which will be read at the next startup of the script.
      What I'm trying to achieve is that the script will read the .ini and check for previously saved functions, and compare them with the functions listed in the ListView.
      If a function is listed in the .ini, but not in the ListView the section containing that function will be deleted. If the function is listed in both the .ini and in the ListView it will leave the section be.
      When it's done going through the prevously saved functions it will parse through comparing the new functions with the old ones and write the new ones into new sections.
      The problem is with the IniReadSectionNames-function when the .ini doesn't contain any sections to read.
      In my world I'd like it to still create an array where $array[0] would be equal to 0 if no sections were found.
      I hope I made myself understood with this. Following is the script in its whole.
      And if anyone happen to have an improvement of any kind I'd be much grateful!
      Best regards,
      zvvyt

      #Include <Misc.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GuiListView.au3> #include <EditConstants.au3> #Include <String.au3> Global $Input_name $Main_window = GUICreate("Folder checker - Settings",400,300,-1,-1) $list = GUICtrlCreateListView("Name |Function |Folder(s) to check |Files |Date    ",20,100,360,150) $Button_new = GUICtrlCreateButton("New",25,260,80,30) $Button_delete = GUICtrlCreateButton("Delete",115,260,80,30) $Button_info = GUICtrlCreateButton("Info",205,260,80,30) $Button_save = GUICtrlCreateButton("Save",295,260,80,30) $Interval_input = GUICtrlCreateInput("0",285,30,40,22) GUICtrlSetLimit(-1,4,1) GUICtrlCreateCombo("ms",340,30,40,30) GUICtrlSetData(-1,"s|min|h") GUISetState(@SW_SHOW) while 1     $msg = GUIGetMsg()     switch $msg         case $GUI_EVENT_CLOSE             Exit         case $Button_new             call("New")             ConsoleWrite("New function ended"&@crlf)         case $Button_delete             call("Delete")         Case $Button_info             call("Info")         case $Button_save             Call("Save")     EndSwitch     if _GUICtrlListView_GetSelectedCount($list) = 0 and GUICtrlGetState($Button_delete) = 80 then         GUICtrlSetState($Button_delete,$gui_disable)         GUICtrlSetState($Button_info,$gui_disable)     EndIf     if _GUICtrlListView_GetSelectedCount($list) > 0 and GUICtrlGetState($Button_delete) = 144 then         GUICtrlSetState($Button_delete,$gui_enable)         GUICtrlSetState($Button_info,$gui_enable)     EndIf WEnd #region "New" part Func New()     #region Function selection part     $Input_name = InputBox("Folder checker - New","Enter a name for the new function"&@crlf&"NOTE! Duplicate or blank names are not allowed","","","","",Default,Default,"",$Main_window)     if @error = 1 then         ConsoleWrite("Cancel@Name check"&@crlf)         Return     EndIf     if @error <> 0 then         ConsoleWrite("ERROR:"&@error&"@Name check")         Return     EndIf     if $Input_name = "" then         Do             $Input_name = InputBox("Folder checker - New","Enter a name for the new function"&@crlf&"NOTE! Duplicate or blank names are not allowed","","","","",Default,Default,"",$Main_window)             if @error = 1 then                 ConsoleWrite("Cancel@Name check"&@crlf)                 Return             EndIf             if @error <> 0 then                 ConsoleWrite("ERROR:"&@error&"@Name check")                 Return             EndIf         until $Input_name <> ""     EndIf     for $1 = 0 to _GUICtrlListView_GetItemCount($list) step +1         $Name_dublicate_check = _GUICtrlListView_GetItemText($list,$1,0)         if $Input_name = $Name_dublicate_check Then             ConsoleWrite("Duplicate names!"&@crlf)             MsgBox(0,"Folder checker - Error", "Name already in use. Please select a new name")             $Input_name = ""             $Name_dublicate_check = ""             call("New")             Return         EndIf     Next     ConsoleWrite("Passed namecheck"&@crlf)     $Select_function = GUICreate("Folder checker - Select a function",200,200,-1,-1,$WS_BORDER,"",$Main_window)     $Select_function_func1 = GUICtrlCreateRadio("Copy files",30,20,170,30) ;-----------------------------------COPY     GUICtrlSetTip(-1,"Click the ""?"" for more info")     $Select_function_func2 = GUICtrlCreateRadio("Move files",30,50,170,30) ;-----------------------------------MOVE     GUICtrlSetTip(-1,"Click the ""?"" for more info")     $Select_function_func3 = GUICtrlCreateRadio("Delete files",30,80,170,30) ;---------------------------------DELETE     GUICtrlSetTip(-1,"Click the ""?"" for more info")     $Select_function_continue = GUICtrlCreateButton("Continue",15,140,80,30)     GUICtrlSetState(-1,$gui_disable)     local $Select_function_continue_disabled = 1     $Select_function_cancel = GUICtrlCreateButton("Cancel",105,140,80,30)     GUISetState(@sw_show)     local $Function_selected = ""     local $Destinating_folder     while 1 ;----------------------------------------Select function         ;if WinActive($Main_window) then WinActivate($Select_function)         GUISetState(@sw_disable,$Main_window)         $msg = GUIGetMsg()         if $Select_function_continue_disabled = 1 and BitXOR(GUICtrlRead($Select_function_func1),GUICtrlRead($Select_function_func2),GUICtrlRead($Select_function_func3)) = $GUI_CHECKED then             GUICtrlSetState($Select_function_continue,$gui_enable)             $Select_function_continue_disabled = 0         EndIf         switch $msg             case $Select_function_cancel                 ConsoleWrite("Cancel@Function selection"&@crlf)                 GUISetState(@SW_ENABLE,$Main_window)                 GUIDelete($Select_function)                 WinActivate($Main_window)                 Return             case $Select_function_continue                 If BitAND(GUICtrlRead($Select_function_func1), $GUI_CHECKED) = $GUI_CHECKED then                     GUIDelete($Select_function)                     $Function_selected = "Copy"                     ;call("NewCopy")                 EndIf                 if BitAND(GUICtrlRead($Select_function_func2), $GUI_CHECKED) = $GUI_CHECKED then                     GUIDelete($Select_function)                     $Function_selected = "Move"                     ;call("NewMove")                 EndIf                 if BitAND(GUICtrlRead($Select_function_func3), $GUI_CHECKED) = $GUI_CHECKED then                     GUIDelete($Select_function)                     $Function_selected = "Delete"                     ;call("NewDelete")                 EndIf                 ;GUISetState(@SW_ENABLE,$Main_window)                 ExitLoop         EndSwitch     WEnd     #endregion End Function selection part     #region Folder selection part     ConsoleWrite($Function_selected)     if $Function_selected = "Delete" then         $Origin_folder = FileSelectFolder("Select file folder","",1,"",$Main_window)         if @error = 1 then             ConsoleWrite("Cancel@Folder selction"&@crlf)             GUISetState(@SW_ENABLE,$Main_window)             Return         EndIf     Else         $Origin_folder = FileSelectFolder("Select file origin folder","",1,"",$Main_window)         if @error = 1 then             ConsoleWrite("Cancel@Origin folder selction"&@crlf)             GUISetState(@SW_ENABLE,$Main_window)             Return         EndIf         $Destinating_folder = FileSelectFolder("Select destinating folder","",1,"",$Main_window)         if @error = 1 then             ConsoleWrite("Cancel@Destinating folder selction"&@crlf)             GUISetState(@SW_ENABLE,$Main_window)             Return         EndIf         if $Origin_folder = $Destinating_folder Then             Do                 MsgBox(0,"Error","Same folder specified. Please chose another folder to copy from/to")                 $Origin_folder = FileSelectFolder("Select file origin folder","",1,"",$Main_window)             if @error = 1 then                 ConsoleWrite("Cancel@Origin folder selction"&@crlf)                 GUISetState(@SW_ENABLE,$Main_window)                 Return             EndIf             $Destinating_folder = FileSelectFolder("Select destinating folder","",1,"",$Main_window)             if @error = 1 then                 ConsoleWrite("Cancel@Destinating folder selction"&@crlf)                 GUISetState(@SW_ENABLE,$Main_window)                 Return             EndIf             until $Origin_folder <> $Destinating_folder         EndIf     EndIf     #endregion End Folder selection part     #region File selection part     $Select_files = GUICreate("Folder checker - Select files",200,200,-1,-1,$WS_BORDER,"",$Main_window)     $All_files = GUICtrlCreateRadio("All files",30,30,170,30)     $Specific_files = GUICtrlCreateRadio("Specific filetype",30,60,170,30)     $Filetype_input = GUICtrlCreateInput("",50,100,100,20)     $Select_files_continue = GUICtrlCreateButton("Continue",15,140,80,30)     GUICtrlSetState(-1,$gui_disable)     Local $Select_files_continue_disable = 1     $Select_files_cancel = GUICtrlCreateButton("Cancel",105,140,80,30)     GUICtrlSetState($Filetype_input,$gui_disable)     GUISetState(@sw_show)     Local $Filetype_input_Dot_checker[4]     while 1         $Filetype_input_Space_checker = StringSplit(GUICtrlRead($Filetype_input)," ")         If $Filetype_input_Space_checker[0] = 2 Then             $Filetype_input_no_space = StringReplace(GUICtrlRead($Filetype_input)," ","")             GUICtrlSetData($Filetype_input,$Filetype_input_no_space)         EndIf         $Filetype_input_Dot_checker = StringSplit(GUICtrlRead($Filetype_input),".")         if $Filetype_input_Dot_checker[0] >= 2 Then             if $Filetype_input_Dot_checker[1] <> "" then                 GUICtrlSetData($Filetype_input,StringReplace(GUICtrlRead($Filetype_input),".","",1))             EndIf             if $Filetype_input_Dot_checker[0] = 3 then                 GUICtrlSetData($Filetype_input,_StringReverse(StringReplace(_StringReverse(GUICtrlRead($Filetype_input)),".","",1)))             EndIf         EndIf         GUISetState(@SW_DISABLE,$Main_window)         if GUICtrlRead($Specific_files) = 1 and GUICtrlRead($Filetype_input) = "" and $Select_files_continue_disable = 0  Then             GUICtrlSetState($Select_files_continue,$gui_disable)             $Select_files_continue_disable = 1         EndIf         if GUICtrlRead($Specific_files) = 1 and GUICtrlRead($Filetype_input) = "." and $Select_files_continue_disable = 0  Then             GUICtrlSetState($Select_files_continue,$gui_disable)             $Select_files_continue_disable = 1         EndIf         if GUICtrlRead($All_files) = 1 and $Select_files_continue_disable = 1 Then             GUICtrlSetState($Select_files_continue,$gui_enable)             $Select_files_continue_disable = 0         EndIf         if GUICtrlRead($Specific_files) = 1 and GUICtrlRead($Filetype_input) <> "" and $Select_files_continue_disable = 1 and GUICtrlRead($Filetype_input) <> "." Then             GUICtrlSetState($Select_files_continue,$gui_enable)             $Select_files_continue_disable = 0         EndIf         $msg = GUIGetMsg()         switch $msg             case $Select_files_cancel                 GUISetState(@SW_ENABLE,$Main_window)                 ConsoleWrite("Cancel@File selection"&@crlf)                 GUIDelete($Select_files)                 Return             case $Specific_files                 GUICtrlSetState($Filetype_input,$gui_enable)             case $All_files                 GUICtrlSetState($Filetype_input,$gui_disable)             case $Select_files_continue                 $Function_date_made_long = @YEAR&@MON&@MDAY&" "&@HOUR&":"&@MIN&":"&@SEC                 $Function_date_made = @MDAY&"/"&@MON&" "&@HOUR&":"&@MIN                 if GUICtrlRead($All_files) = $GUI_CHECKED Then                     if $Function_selected = "Delete" then                         GUICtrlCreateListViewItem($Input_name&"|"&$Function_selected&"|"&$Origin_folder&"|All|"&$Function_date_made_long,$list)                     Else                         GUICtrlCreateListViewItem($Input_name&"|"&$Function_selected&"|"&$Origin_folder&" to "&$Destinating_folder&"|All|"&$Function_date_made_long,$list)                     EndIf                     GUIDelete($Select_files)                     ConsoleWrite("All files"&@crlf)                 EndIf                 if GUICtrlRead($Specific_files) = $GUI_CHECKED and GUICtrlRead($Filetype_input) <> "" then                     $Filetype_input_Dot_checker = StringSplit(GUICtrlRead($Filetype_input),".")                     if $Filetype_input_Dot_checker[0] = 1 Then                         GUICtrlSetData($Filetype_input,"."&GUICtrlRead($Filetype_input))                     EndIf                     $Filetype_input = StringLower(GUICtrlRead($Filetype_input))                     if $Function_selected = "Delete" then                     GUICtrlCreateListViewItem($Input_name&"|"&$Function_selected&"|"&$Origin_folder&"|"&$Filetype_input&"|"&$Function_date_made_long,$list)                     Else                         GUICtrlCreateListViewItem($Input_name&"|"&$Function_selected&"|"&$Origin_folder&" to "&$Destinating_folder&"|"&$Function_date_made_long,$list)                     EndIf                     GUIDelete($Select_files)                     ConsoleWrite("Specific files"&@crlf)                 EndIf                 GUISetState(@SW_ENABLE,$Main_window)                 ExitLoop         EndSwitch     WEnd     #endregion End File selection part     WinActivate($Main_window) EndFunc #endregion func Delete()     _GUICtrlListView_DeleteItemsSelected($list) EndFunc Func Info() EndFunc Func Save() ;-------------------------------------------------------- Trouble starts here! --------------------------------------     ConsoleWrite("Save initialized"&@CRLF)     GUICtrlSetState($Button_save,$gui_disable)     if not FileExists("Settings.ini") Then         ConsoleWrite("No Settings.ini-file found"&@CRLF)         IniWrite("Settings.ini","","","")     Else         $Save_check_earlier_functions = IniReadSectionNames("Settings.ini")         if @error then MsgBox(0,"","")         $Save_check_current_functions = _GUICtrlListView_GetItemCount($list)         if $Save_check_earlier_functions[0] <> 0 Then             ConsoleWrite("Earlier functions differ to 0"&@CRLF)             For $count1 = 1 to $Save_check_earlier_functions[0] step +1                 for $count2 = 1 to $Save_check_current_functions step +1                     ;ConsoleWrite($Save_check_earlier_functions[$count2]&@CRLF)                     if  $Save_check_earlier_functions[$count2] = _GUICtrlListView_GetItemText($list,$count1,0) then                     Else                         if $count2 = $Save_check_earlier_functions[0] Then IniDelete("Settings.ini",$Save_check_earlier_functions[$count2])                     EndIf                 Next             Next             For $count1 = 1 to $Save_check_current_functions step +1                 for $count2 = 1 to $Save_check_earlier_functions[0] step +1                     ConsoleWrite(_GUICtrlListView_GetItemText($list,$count2,0)&@CRLF)                     if _GUICtrlListView_GetItemText($list,$count2,0) = $Save_check_earlier_functions[$count1] Then                         ExitLoop                     Else                         IniWrite("Settings.ini",_GUICtrlListView_GetItemText($list,$count2,0),"Function",_GUICtrlListView_GetItemText($list,$count2,1))                         IniWrite("Settings.ini",_GUICtrlListView_GetItemText($list,$count2,0),"Folder",_GUICtrlListView_GetItemText($list,$count2,2))                         IniWrite("Settings.ini",_GUICtrlListView_GetItemText($list,$count2,0),"File",_GUICtrlListView_GetItemText($list,$count2,3))                         IniWrite("Settings.ini",_GUICtrlListView_GetItemText($list,$count2,0),"Date",_GUICtrlListView_GetItemText($list,$count2,4))                     EndIf                 Next             Next         EndIf     ;EndIf     ;ConsoleWrite(_GUICtrlListView_GetItemCount($list)&@CRLF)     ;ConsoleWrite(_GUICtrlListView_GetItemText($list,0,1)&@CRLF)     GUICtrlSetState($Button_save,$gui_enable)     ConsoleWrite("Save finished"&@CRLF) EndFunc;-------------------------------------------------------- Trouble ends here! --------------------------------------  
    • cueclub
      By cueclub
      I am trying to pull information from different files.

      They will all be grouped together by name.

      In treeview I would have

      Last Name << This labels would be the actual name.
      -First Name
      -Address
      -Phone Number

      I currently have the above information saved into 4 different ini files.

      I am writting the values as Section Keys.

      Like so:
      IniWriteSection(@ScriptDir & "\First Name.ini", GUICtrlRead($Name),"")
      Then read it into an array such as

      Local $Name2 = IniReadSectionNames(@ScriptDir & "\First Name.ini") For $I = 1 To $Name2[0] GUICtrlSetData(-1, $Name2[$I] & "|") Next The problem is I can not get the separate values into the TreeView based on what last name is selected.

      Here is what I have so far:

      Onlastnamesearch("CueClub") Func Onlastnamesearch($LastName) GUICreate("Notes for " & $LastName, 300, 250, -1, -1, "", $WS_EX_TOPMOST) GUICtrlCreateLabel("LAST NAME", 5, 10, 60, 40) Local $Tmp = IniReadSectionNames(@ScriptDir & "\Last Name.ini") Local $Tmp2 = GUICtrlCreateTreeView(5, 50, 170, 100) For $I = 1 To $tmp[0] $tmp3 = GUICtrlCreateTreeViewItem($tmp[$i], $Tmp2) $FirstName = GUICtrlCreateTreeViewItem("First Name", $Tmp3) $Address = GUICtrlCreateTreeViewItem("Address", $Tmp3) $PhoneNumber = GUICtrlCreateTreeViewItem("Phone Number", $Tmp3) Next Local $exit = GUICtrlCreateButton("Exit", 5, 160, 50, 20) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $exit Or $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete() EndFunc ;==>Example As you can see above, I can get the treeview to populate, and even the tree items, However I am stumped as to how to pull the data from the separate ini files and display them based on what is clicked on the treeview.

      I have read the help file, and searched here a bit, but it is a bit confusing for me.

      Any help would be appreciated.

      CC