CrewXp Posted September 19, 2005 Share Posted September 19, 2005 (edited) 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=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=NotCheckedExample, 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. Edited September 19, 2005 by CrewXp Link to comment Share on other sites More sharing options...
Wb-FreeKill Posted September 21, 2005 Share Posted September 21, 2005 (edited) Not sure what you want, but take a look at this.. MyProg.au3 Edited September 21, 2005 by Wb-FreeKill 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