shouman
16th June 2005 09:56 UTC
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.
Mæster
16th June 2005 10:21 UTC
What do you mean with ".ini file UI"? Is it a Install options page with 2 label and 2 text fields?
shouman
16th June 2005 10:30 UTC
yes it is.
Mæster
16th June 2005 11:00 UTC
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.
shouman
16th June 2005 11:35 UTC
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
Mæster
16th June 2005 11:51 UTC
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 ;-).
shouman
16th June 2005 12:17 UTC
I choose the second one.
Mæster
16th June 2005 13:02 UTC
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
shouman
16th June 2005 13:25 UTC
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.