Bert Posted September 30, 2005 Posted September 30, 2005 I'm trying to learn about using IniRead, and I'm having trouble getting it to work. I know I'm doing something wrong, but not sure what. I wrote a test script to figure it out, and IniRead keeps erroring out with a return code of 1. What I'm trying to do is get what is listed in the ini file to show up in the right window. expandcollapse popup#include <GUIConstants.au3> #Include <GuiList.au3> ;--------------------<GUI>--------------------------- GUICreate("Test WIndow", 655, 500, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_GROUP, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU)) Global $testlist = GUICtrlCreateList("", 350, 10, 300, 450) Dim $input $maintree = GUICtrlCreateTreeView(10, 10, 300, 450) $oneitem = GUICtrlCreateTreeViewItem("One", $maintree) $twoitem = GUICtrlCreateTreeViewItem("Two", $maintree) GUISetState(@SW_SHOW) ;End GUI Dim $desktop While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit ;-------<controls>-------------- Case $msg = $oneitem _GUICtrlListClear($testlist) $var = IniReadSection ("C:\boot.ini", "boot loader") MsgBox(4096, "Result", $var) GUICtrlSetData($testlist, $var) $data = GUICtrlRead($testlist) Case $msg = $twoitem _GUICtrlListClear($testlist) GUICtrlSetData($testlist, "Two|TWO|twO") $data = GUICtrlRead($testlist) ;End Controls EndSelect WEnd GUIDelete() Exit The Vollatran project My blog: http://www.vollysinterestingshit.com/
GaryFrost Posted September 30, 2005 Posted September 30, 2005 (edited) you sure you have access to that ini? Try double clicking the ini and see what happens. Edited September 30, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Bert Posted September 30, 2005 Author Posted September 30, 2005 I used boot.ini as a test. Yes, I can open it to view. I have also tried to make a ini and point it there. same result second question; how does one add a scrollbar to the code section of a post? The Vollatran project My blog: http://www.vollysinterestingshit.com/
GaryFrost Posted September 30, 2005 Posted September 30, 2005 (edited) CODE#include <GUIConstants.au3>#Include <GuiList.au3>;--------------------<GUI>---------------------------GUICreate("Test WIndow", 655, 500, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_GROUP, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU))Global $testlist = GUICtrlCreateList("", 350, 10, 300, 450)Dim $input$maintree = GUICtrlCreateTreeView(10, 10, 300, 450)$oneitem = GUICtrlCreateTreeViewItem("One", $maintree)$twoitem = GUICtrlCreateTreeViewItem("Two", $maintree)GUISetState(@SW_SHOW);End GUIDim $desktopWhile 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit ;-------<controls>-------------- Case $msg = $oneitem _GUICtrlListClear ($testlist) $var = IniReadSection(@ScriptDir & "\my.ini", "02-03") MsgBox(4096, "Result", $var[0][0]) For $i = 1 To $var[0][0] GUICtrlSetData($testlist, $var[$i][0]) Next $data = GUICtrlRead($testlist) Case $msg = $twoitem _GUICtrlListClear ($testlist) GUICtrlSetData($testlist, "Two|TWO|twO") $data = GUICtrlRead($testlist) ;End Controls EndSelectWEndGUIDelete()Exitcontents of my.ini[02-03]Name=AprilPage=02-03Topic=DogsUserStatus=CompletedDue=11/11/05Section=Student LifeEditStatus=NotChecked[03-04]Name=LauraPage=03-04Topic=CarsUserStatus=CompletedDue=11/11/05Section=Student LifeEditStatus=NotChecked[04-05]Name=JakePage=04-05Topic=MathUserStatus=IncompleteDue=12/11/05Section=AcademicsEditStatus=NotChecked[06-07]Name=AprilPage=06-07Topic=ScienceUserStatus=IncompleteDue=12/11/05Section=AcademicsEditStatus=NotCheckedsecond question; how does one add a scrollbar to the code section of a post? codebox instead of code Edited September 30, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Bert Posted September 30, 2005 Author Posted September 30, 2005 OK, that makes sense. I see what you did. I think INIread isn't what I need. How then do I get a list to show up in GUICtrlCreateList using a file as a reference, such as a text file or a ini, with the contents in the file shown in the following format: item 1 item 2 item 3 Also, I need to be able to click on one item in the list, and have that data read. I know I can use GUICtrlSetData, but the data then has to be formatted like this: item1|item2|item3 This doesn't work for when one need to add or remove data from the file, it can be extreamly tedious. I have to look at this from a user's point of view of ease of being able to change data. The Vollatran project My blog: http://www.vollysinterestingshit.com/
ligenza Posted September 30, 2005 Posted September 30, 2005 (edited) If you look at your code: GUICreate("Test WIndow", 655, 500, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_GROUP, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU)) Global $testlist = GUICtrlCreateList("", 350, 10, 300, 450) Dim $input $Input is a global variable so you should not use Dim to declare it. It's not really good programming practice to even use Dim as it has weird scope rules, either use local or global. We just went over this on AIM so shame on you. I'd answer your question but I think you're trying to run before you can walk! If you search the forum you'll find examples of both reading from an .ini and using StringFormat, I was just posting in a few threads like that the other day. Edited September 30, 2005 by ligenza
Bert Posted October 3, 2005 Author Posted October 3, 2005 As I said before, and I will say again, I learn by trying to solve a certain problem. silly! I didn't make the connection on what you were telling me last weeknd! And yes, I fully intend on running before I can walk! Currently the information I'm recompiling is in a excel spreadsheet that is updated about daily. I figured out I may be able to pull the information directly from it to populate the fields. This is something that really needs to get done, so I fully intend I will be a goof and try to run before I can walk! :"> I like to add it is alot easier to look stuff up when you know what you are looking for. Try asking a blind person what the color blue looks like. You will get a real funny answer. I have never heard of StringFormat until you mentioned it. Yes, I could spend hours searching, or I could post the question, and get a quick answer. I did spend a couple of hours trying to find the answer on my own, but I'm like the blind man at this moment! Be patient with me please! I know you are thinking this about me... I'm really trying however! The Vollatran project My blog: http://www.vollysinterestingshit.com/
GaryFrost Posted October 3, 2005 Posted October 3, 2005 @vollyman, just ignore the peanut gallery, supposedly that person won't be coming back to the forum to annoy the users anymore, time will tell.If you don't mind using beta, you might want to look at this thread about excel com udfshttp://www.autoitscript.com/forum/index.php?showtopic=14166 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Bert Posted October 3, 2005 Author Posted October 3, 2005 Actually, ligenza is pretty kewl, though she is just giving me a hard time at the moment! She has been great in helping me out with stuff, and she is trying to get me to learn the right way. I'm currently looking at the link, and have downloaded some of the items there. Alot of the stuff is greek to me, though I'm starting to make sense of it. I'm looking to see how to use the ExcelCOM to see how to pull data so that I can do the following: 1. The spreadsheet has currently 12079 entries. This is updated or changed frequently, so I can't use the line number as a reference point when polling data. 2. Column B has the groups. I need to use this as the reference point of the items in column C. I pulled out the included example from the spreadsheet to show what Im talking about. It will need to be renamed with the *.xls ext to view. In the example, I need to pull all the items listed in "application" to one GUICtrlCreateList window, and pull all the items listed in "customer service" to another GUICtrlCreateList window. I have about 60 different things that can be listed in column B. Also, for the applications group, I want to break it down alphabetically, so the list that is presented with GUICtrlCreateList won't be so long. (THis is sTarting tO hurt mY brAin) The Vollatran project My blog: http://www.vollysinterestingshit.com/
Bert Posted October 3, 2005 Author Posted October 3, 2005 I looked at it, and It won't do what I need. It can find data by column and row number, not by the data in the cell. (unless I'm reading it wrong) Anyone else got any ideas? The Vollatran project My blog: http://www.vollysinterestingshit.com/
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