|
|
#1 |
|
Member
Join Date: Jul 2015
Posts: 62
|
Reading value from Config file to textbox
Hi All,
I have a Custom Dialog that has a few ports that the user must enter. I have some default values in them. If there a config file existing in the install directory, the ports must auto populate on the custom dialog. I have all the pieces of the code in place. I just wanted to know if there is a cleaner way of doing it. I am pasting excerpts for just one of the port. Will need to duplicate this code for the other ports also. 1)In my main nsi I have this. $PortNumber is a global variable. I grab the value of the port. IfFileExists $INSTDIR\conf\tomcat.properties 0 pastFilecheck MessageBox MB_OK "found the properties file" ${ConfigRead} "$INSTDIR\conf\my.properties" "port.shutdown=" $R1 MessageBox MB_OK "Port number is: $R1" StrCpy $PortNumber $R1 pastFilecheck: 2)In my custom dialog .nsh file I have this. Check if port value exists or load the default value. ${If} $PortNumber == '' StrCpy $PortNumber '9954' MessageBox MB_OK "New port number is :$PortNumber" ${NSD_SetText} $hCtl_FoundationDialog_TextBox1 $PortNumber ${EndIf} ; === TextBox1 (type: Text) === ${NSD_CreateText} 127.7u 37.54u 111.24u 12.31u "$PortNumber" Pop $hCtl_FoundationDialog_TextBox1 |
|
|
|
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|