Archive: My problem


My problem
I have a .txt file consist of some information.just like that....
username=a
password=b

Now I have a .ini file(UI) where there is label and text box for username and password.

The main question is how can I read that .txt file into the UI??Because there is no user input.Input will just read from that .txt file which will show in the UI.

Can anyone show me the path,just now???

Badly needed.


What do you mean with ".ini file UI"? Is it a Install options page with 2 label and 2 text fields?


yes it is.


Every install options page is saved and loaded from a corresponding ini, right? If you would like to change a control of your install options page (iop) then you easely change the iop ini, before the page is loaded from this ini.

use

!insertmacro MUI_INSTALLOPTIONS_WRITE

to change the ini before the page is shown.

If you could post your iop-ini, i could go in more details.


I used this function "Read from INI style file without section headers".
Function ReadINIStrNS
..........
;I think you know all the code of this function.
...........
FunctionEnd

Because I don't want to use section headers in ini file


There are 2 steps on your way:
1. Read the user and password from your personal ini structured file (using ReadINIStrNS or whatever)
2. Write those values in the iop-ini (using MUI_INSTALLOPTIONS_WRITE) to change the values of your iop_text_controls ;-).


I choose the second one.


Maybe you didnt understand me right. You have to do both steps.

Lets say we have the following:
1. user.txt (ini structured file with username, password)
2. iop.ini (install options page with user_label [field1], password_label [field2], user_textbox [field3], password_textbox [field4])

# display a install options page with username, password
Page custom ShowUserData

Function ShowUserData

# read username, password from the txt file
Push "[path to your file]\user.txt" ; ini file
Push "username"
Call ReadINIStrNS
Pop $R0 ; $R0 is the username

Push "[path to your file]\user.txt" ; ini file
Push "password"
Call ReadINIStrNS
Pop $R1 ; $R1 is the password

# write username, password to the iop.ini file
!insertmacro MUI_INSTALLOPTIONS_WRITE "iop.ini" "Field 3" "Text" $R0
!insertmacro MUI_INSTALLOPTIONS_WRITE "iop.ini" "Field 4" "Text" $R1

# show the install options page with the data
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "iop.ini"

FunctionEnd

Oh shit,it's a simple issue but I missed it.Damn it.

M,it's a great help from you.Thank you very much.