Jump to content

dragonrider

Members
  • Posts

    5
  • Joined

  • Last visited

dragonrider's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Could someone do me a favor? I'm new to this thread & would like to know where the GuiStatusBar.au3 file is located. Help much appreciated. P.S. are the changes & additions from this thread in the file you are giving me the URL for? Regards Dragonrider
  2. I agree with changing it from the "Select" to the "Switch" statement, but you forgot to make the string uppercase. So you need to replace: Switch StringLeft($MonthString, 3) with: Switch StringUpper( StringLeft($MonthString, 3) ) Regards Dragonrider
  3. I found 2 bugs in the code I posted. 1. It said that the .INI file may not exist when there were no key/value pairs in a section. and 2. It didn't display the key's value. Both have been corrected and the original code above has been edited. Regards Dragonrider P.S. It now reads my win.ini just fine when I put it into the same folder as the script & rename it to "Logfile1.ini".
  4. Try the code below. I changed around a few things & cleaned it up somewhat (removed variables that weren't being used etc.) so I could understand what you were doing. Hope you don't mind. java script:emoticon('', 'smid_8') smilie Your main problem was that you were trying to use a local variable "$x" (now $i_SectionIndex) from the _IniGetSectionNames() function in the _IniReadInfo() function. The _IniReadInfo() function doesn't know anything about this variable & creates it on 1st use & assigns a null value to it. So nothing was being added to the treeview because of it. I also changed the "kpu-24" entry to the name of each section name by replacing it with $varx[$i_SectionIndex]. This seems to be more informative as far as the displaying of the .INI file is concerned. HTH Dragonrider Here's the code. #include <GuiConstants.au3> #include <file.au3> #include <array.au3> Dim $msg = "" Dim $file = "logfile1.ini" Dim $TreeView = _CreateGUI() _IniGetSectionNames( $file, $TreeView ) GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit Func _IniGetSectionNames( $file, $TreeView ) Local $varx = IniReadSectionNames( $file ) If @error Then Local $RetCode = MsgBox(5000, "", "Error occured, probably no INI file.") If( $RetCode = 6 ) Then Exit() EndIf Else For $i_SectionIndex = 1 To $varx[0] MsgBox(4096, "", $varx[$i_SectionIndex]) _IniReadInfo( $file, $varx, $TreeView, $i_SectionIndex ) Next EndIf EndFunc Func _IniReadInfo( $file, $varx, $TreeView, $i_SectionIndex ) ;MsgBox(32,"VarX","Varx = " & $varx[$i_SectionIndex]) Local $TreeView2 = GUICtrlCreateTreeViewitem($varx[$i_SectionIndex],$TreeView ) Local $var = IniReadSection($file,$varx[$i_SectionIndex]) If @error Then ; MsgBox(4096, "", "Error occured, probably no INI file.") Return Else For $i = 1 To $var[0][0] GUICtrlCreateTreeViewItem($var[$i][0] & " = " & $var[$i][1], $TreeView2) MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF );& "Value: " & $var[$i][1]) Next EndIf EndFunc Func _CreateGUI() If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 GuiCreate("Form2", 420, 331, 430,346 ,BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) Return GUICtrlCreateTreeView(16, 16, 353, 217) EndFuncTreeview_From_INI.au3
×
×
  • Create New...