Copyrigth Posted March 14, 2013 Share Posted March 14, 2013 (edited) Hi, I was wondering if there is a way to populate an listview using ini file? My ini file looks like this: [copmuter1] user=student OS=win7 [copmuter2] user=Admin OS=winxp Edited March 14, 2013 by Copyrigth Link to comment Share on other sites More sharing options...
BrewManNH Posted March 14, 2013 Share Posted March 14, 2013 Yes there is. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Copyrigth Posted March 14, 2013 Author Share Posted March 14, 2013 Yes there is.Can you please point me in the direction? Link to comment Share on other sites More sharing options...
BrewManNH Posted March 14, 2013 Share Posted March 14, 2013 It depends on what you want the listview to look like with the data you have. 1 column, 2 columns, 3 columns? User name in one column and computer name in another, and/or with the OS version in a third for instance. Give me something to work with rather than ask if it's possible with no clue what you're looking to do with the data. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Copyrigth Posted March 14, 2013 Author Share Posted March 14, 2013 I was thinking about what you described, with 3 collums like this: Field1 | Field2 | Field3 User | computername | OS Link to comment Share on other sites More sharing options...
kylomas Posted March 14, 2013 Share Posted March 14, 2013 (edited) copyrigth, This should get you started... expandcollapse popup; *** Start added by AutoIt3Wrapper *** #include <Constants.au3> #include <GUIConstantsEx.au3> ; *** End added by AutoIt3Wrapper *** #include <array.au3> #AutoIt3Wrapper_Add_Constants=n local $iniFile = @scriptdir & '\computers.ini' local $aSections = IniReadSectionNames($iniFile) if not isarray($aSections) then msgbox($mb_ok,'INI READ Section Names ERROR','File = ' & $iniFile) Exit endif local $gui010 = guicreate('INI to ListView control Example') local $aGuiSize = wingetclientsize($gui010) local $lv010 = guictrlcreatelistview('Computer|Student|OpSys',20,20,$aGuiSize[0]-40,$aGuiSize[1]-40) guisetstate() ; populate listview local $aSection, $sLVItem for $1 = 1 to $aSections[0] $aSection = inireadsection($iniFile,$aSections[$1]) if @error = 1 then msgbox($mb_ok,'INI READ Section ERROR','File = ' & $iniFile) Exit endif for $2 = 1 to $aSection[0][0] $sLVItem &= $aSection[$2][1] & '|' next if guictrlcreatelistviewitem($aSections[$1] & '|' & $sLVItem,$lv010) = 0 then msgbox($mb_ok,'ListView Item Create ERROR','Item = ' & $aSections[$1] & '|' & $sLVItem) Exit endif $sLVItem = '' next while 1 switch guigetmsg() case $gui_event_close Exit EndSwitch wend kylomas edit: the ini file looks like this [copmuter1] user=student001 OS=win7 [copmuter2] user=Admin OS=winxp [copmuter3] user=student009 OS=win7 [copmuter4] user=dumb ass student OS=win7 [copmuter5] user=M23 OS=win7 Edited March 14, 2013 by kylomas Copyrigth 1 Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Copyrigth Posted March 14, 2013 Author Share Posted March 14, 2013 Thank you so much kylomas Link to comment Share on other sites More sharing options...
kylomas Posted March 14, 2013 Share Posted March 14, 2013 My pleasure, now it's your turn. If you don't understand something, look it up in the HELP file and see how it works within the context of this script. Good Luck, kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Copyrigth Posted March 14, 2013 Author Share Posted March 14, 2013 Will do Link to comment Share on other sites More sharing options...
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