CrewXp Posted September 28, 2005 Share Posted September 28, 2005 (edited) *************(Please read my bottom post for my latest code)***********I'm trying to make a program that reads an ini for the key: Name then displays info about that section. When a user logs in, their name is assigned to the variable $user, which is also equal to the key: Name. How can I do this? This was a bit of code which has the idea im looking for from another dedicated user. ThxExample: User's name is April, they log in and press the shortcut for this program. It loads and then shows a drop down box of the pages they have (it looks in each section to see if their $user is in a key called Name. If it finds it, it shows it in the drop down). Then they select their page, click open and it opens the page W:\01-02.indd ('page'.indd); please place the location of the ini file hereDim $Location = "my.ini"Dim $Sec_data#include "GUIConstants.au3"If Not FileExists( $Location) ThenMsgBox(0,"Sorry"," the ini file was not found ")ExitEndIfCall("Read_Sections")$PT_win = GuiCreate(" My Ladder, by QTasc", 240,120)$button_1 = GUICtrlCreateButton("A&ccept", 20, 80, 60, 23)GUICtrlSetState(-1,$GUI_DEFBUTTON)$button_2 = GUICtrlCreateButton("C&ancel", 160, 80, 60, 23);Create 1 combo box, give focus and populate with contents$combo_1 = GUICtrlCreateCombo( "", 53, 43, 123, 20)GUICtrlSetState(-1,$GUI_FOCUS) GUICtrlSetData(-1,$Sec_data);GUICtrlSetFont( -1, 9, 550)$label_1 = GUICtrlCreateLabel( "Please Choose a File", 20, 15, 250, 20)GUICtrlSetFont( -1, 10, 600)GuiSetState (@SW_SHOW)While 1 $LSmsg = GuiGetMsg()Selectcase $LSmsg = $button_2 Or $LSmsg = $GUI_EVENT_CLOSEExitcase $LSmsg = $button_1$LSID = GuictrlRead($combo_1)If $LSID = "" ThenMsgBox(64, "Error", "No File Chosen")EndIfIf $LSID > "" ThenCall("Read_ini")EndIfEndSelectWEnd;---------------------- functions ---------------------------Func Read_Sections()Local $t = 1$Sections = IniReadSectionNames($Location)for $t = 1 to $Sections[0]If @error then ExitLoop$Sec_data = $Sec_data & $Sections[$t] & "|"NextEndFuncFunc Read_ini()$var = IniReadSection($Location, $LSID)If @error Then MsgBox(4096, "", "Error occured, probably no INI file.")ElseFor $i = 1 To $var[0][0]MsgBox(4096, "", $var[$i][0] & @CRLF & $var[$i][1])NextEndIfEndFuncmy.ini example:[02-03]Name=AprilPage=02-03Topic=DogsUserStatus=CompletedDue=11/11/05Section=Student LifeEditStatus=NotCheckedLocation = C:\YbTest\file1.indd[03-04]Name=LauraPage=03-04Topic=CarsUserStatus=CompletedDue=11/11/05Section=Student LifeEditStatus=NotCheckedLocation = C:\YbTest\file2.indd[04-05]Name=JakePage=04-05Topic=MathUserStatus=IncompleteDue=12/11/05Section=AcademicsEditStatus=NotCheckedLocation = C:\YbTest\file3.indd[06-07]Name=AprilPage=06-07Topic=ScienceUserStatus=IncompleteDue=12/11/05Section=AcademicsEditStatus=NotCheckedLocation = C:\YbTest\file4.inddExample, if April logs in, and $user is April, it checks sections with the Key: April and displays the sections its found in. So 02-03 and 06-07 will be shown in the drop-down. Then they can select it and click open to open it. (It would open with the key: Location = C:\blah\blah.indd) Edited September 29, 2005 by CrewXp Link to comment Share on other sites More sharing options...
Valuater Posted September 28, 2005 Share Posted September 28, 2005 you made effort on the other program and i helped i helped on this program and you have not done anything... so maybe you could use part of the other script.. to help BUT... most of all show some effort, don't just expect me (or us) to write everything for you 8) Link to comment Share on other sites More sharing options...
CrewXp Posted September 28, 2005 Author Share Posted September 28, 2005 (edited) (Code Deleted), I've posted the updated code at the bottom Edited September 29, 2005 by CrewXp Link to comment Share on other sites More sharing options...
CrewXp Posted September 29, 2005 Author Share Posted September 29, 2005 I've tinkered with the code for about 2 hours so far today and I get things almost, but just can't get it Link to comment Share on other sites More sharing options...
CrewXp Posted September 29, 2005 Author Share Posted September 29, 2005 (edited) -Update (I did it, thanks for all the motivation!) Edited September 29, 2005 by CrewXp 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