Sign in to follow this  
Followers 0
CrewXp

Program that reads an ini for a key, then displays other key values in a box. They can click open, or change page. How can I do this? Examples in post

5 posts in this topic

#1 ·  Posted (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. Thx

Example: 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 here

Dim $Location = "my.ini"

Dim $Sec_data

#include "GUIConstants.au3"

If Not FileExists( $Location) Then

MsgBox(0,"Sorry"," the ini file was not found ")

Exit

EndIf

Call("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()

Select

case $LSmsg = $button_2 Or $LSmsg = $GUI_EVENT_CLOSE

Exit

case $LSmsg = $button_1

$LSID = GuictrlRead($combo_1)

If $LSID = "" Then

MsgBox(64, "Error", "No File Chosen")

EndIf

If $LSID > "" Then

Call("Read_ini")

EndIf

EndSelect

WEnd

;---------------------- 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] & "|"

Next

EndFunc

Func Read_ini()

$var = IniReadSection($Location, $LSID)

If @error Then

MsgBox(4096, "", "Error occured, probably no INI file.")

Else

For $i = 1 To $var[0][0]

MsgBox(4096, "", $var[$i][0] & @CRLF & $var[$i][1])

Next

EndIf

EndFunc

my.ini example:

[02-03]Name=April

Page=02-03

Topic=Dogs

UserStatus=Completed

Due=11/11/05

Section=Student Life

EditStatus=NotChecked

Location = C:\YbTest\file1.indd

[03-04]

Name=Laura

Page=03-04

Topic=Cars

UserStatus=Completed

Due=11/11/05

Section=Student Life

EditStatus=NotChecked

Location = C:\YbTest\file2.indd

[04-05]

Name=Jake

Page=04-05

Topic=Math

UserStatus=Incomplete

Due=12/11/05

Section=Academics

EditStatus=NotChecked

Location = C:\YbTest\file3.indd

[06-07]

Name=April

Page=06-07

Topic=Science

UserStatus=Incomplete

Due=12/11/05

Section=Academics

EditStatus=NotChecked

Location = C:\YbTest\file4.indd

Example, 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 by CrewXp

Share this post


Link to post
Share on other sites



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)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

(Code Deleted), I've posted the updated code at the bottom

Edited by CrewXp

Share this post


Link to post
Share on other sites

I've tinkered with the code for about 2 hours so far today and I get things almost, but just can't get it

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

-Update (I did it, thanks for all the motivation!)

Edited by CrewXp

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0