Wingens Posted February 17, 2020 Posted February 17, 2020 I am trying to create a tool for our support guys to fill in the server checks they need to do. Right now the fill in a paper form. I created a GUI wich saves the data in an ini-file every server has a ini-file with the same layout. In the history tab we would like to pick a server from a combo list and at that point read the ini file match the sections with the check-id numbers and view them in a listview. I am struggeling with creating a way to fill in the listview with the inifile data that is match with different sections. The combobox is filled with an inifile with names: [SERVERS] APOLLO2CS0 = *.*.*.* APOLLO2CS1 = *.*.*.* APOLLO2CS2 = *.*.*.* APOLLO2CS3 = *.*.*.* APOLLO2CS4 = *.*.*.* APOLLO2CS5 = *.*.*.* APOLLO2CS6 = *.*.*.* The Inifile per server looks like: [LASTCHECK] Datum=17-02-2020 [NEXTCHECK] Datum=16-03-2020 [CONTROLEID] 1=1 3=3 4=4 [CHECKDATUM] 1=14-02-2020 3=17-02-2020 4=17-02-2020 [SCHIJFRUIMTE] 1=Ja 3=Ja 4=Ja [BACKUP] 1=Nee 3=Ja 4=Ja [CHECKSERVER] 1=Nee 3=Ja 4=Nee [APOLLOCSLOG] 1=Ja 3=Ja 4=Ja [EVENTVIEWER] 1=Nee 3=Ja 4=Nee [WUPDATE] 1=Nee 3=Ja 4=Ja [REBOOT] 3=Nee 4=Ja I added the code i have so far. You will probebly get an error opening the GUI because you are missing files. Hopefully you guys can help me. V0.1.au3Fetching info...
Subz Posted February 17, 2020 Posted February 17, 2020 Does ControlEID key names always match the section key names? If so then just read the CONTROLEID Section and then use the keys to read each of the other sections into an array. Example[CONTROLEID]1=13=34=4 [WUPDATE]1=Nee3=Ja4=Ja Global $g_sIniServer = @ScriptDir & "\Bin\APOLLO2CS0\check.ini" Global $g_aControlEID = IniReadSection($g_sIniServer, "CONTROLEID") If @error Then Exit Global $g_aHistory[$g_aControlEID[0][0]][8] For $i = 0 To UBound($g_aHistory) - 1 $g_aHistory[$i][0] = $g_aControlEID[$i + 1][1] $g_aHistory[$i][1] = IniRead($g_sIniServer, "CHECKDATUM", $g_aControlEID[$i + 1][0], "") $g_aHistory[$i][2] = IniRead($g_sIniServer, "SCHIJFRUIMTE", $g_aControlEID[$i + 1][0], "") $g_aHistory[$i][3] = IniRead($g_sIniServer, "BACKUP", $g_aControlEID[$i + 1][0], "") $g_aHistory[$i][4] = IniRead($g_sIniServer, "APOLLOCSLOG", $g_aControlEID[$i + 1][0], "") $g_aHistory[$i][5] = IniRead($g_sIniServer, "EVENTVIEWER", $g_aControlEID[$i + 1][0], "") $g_aHistory[$i][6] = IniRead($g_sIniServer, "WUPDATE", $g_aControlEID[$i + 1][0], "") $g_aHistory[$i][7] = IniRead($g_sIniServer, "REBOOT", $g_aControlEID[$i + 1][0], "") Next _ArrayDisplay($g_aHistory) _GUICtrlListView_AddArray($HISTLISTVIEW, $g_aHistory) Quick note, you could create a custom function for a lot of your code that is repeatable.
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