Old 3rd September 2020, 09:16   #1
ducvinhbp
Junior Member
 
Join Date: Sep 2020
Posts: 16
Post CreateIPaddress control to ini file

I have an installation file packed with NSIS, can you help me see the packaging of that file?
ducvinhbp is offline   Reply With Quote
Old 3rd September 2020, 12:46   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
Your post title is not very descriptive, edit and try again.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 3rd September 2020, 16:29   #3
ducvinhbp
Junior Member
 
Join Date: Sep 2020
Posts: 16
sorry i am new and dont understand anything.
I have a setup file that uses "TextReplace" to modify the path and IP address of the computer into the ini files. can you help me ?
ducvinhbp is offline   Reply With Quote
Old 4th September 2020, 13:26   #4
ducvinhbp
Junior Member
 
Join Date: Sep 2020
Posts: 16


how to add IP address to setup window. and how to get this IP address automatically corrected to * .ini file
ducvinhbp is offline   Reply With Quote
Old 4th September 2020, 13:28   #5
ducvinhbp
Junior Member
 
Join Date: Sep 2020
Posts: 16
https://www.upsieutoc.com/images/2020/09/04/ip.png
ducvinhbp is offline   Reply With Quote
Old 4th September 2020, 15:30   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
Use nsDialogs to create custom pages.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 5th September 2020, 12:13   #7
ducvinhbp
Junior Member
 
Join Date: Sep 2020
Posts: 16
Quote:
Originally Posted by Anders View Post
Use nsDialogs to create custom pages.

can you tell me the reason
ducvinhbp is offline   Reply With Quote
Old 5th September 2020, 12:20   #8
ducvinhbp
Junior Member
 
Join Date: Sep 2020
Posts: 16


I have done this. I want the imported IP address to be saved in my "* .ini" file. can you guide me
ducvinhbp is offline   Reply With Quote
Old 5th September 2020, 12:21   #9
ducvinhbp
Junior Member
 
Join Date: Sep 2020
Posts: 16
outfile 'test_install.exe'

!include 'nsdialogs.nsh'
!include "MUI2.nsh"


Name "Program"
OutFile Program.exe
InstallDir $Temp

!insertmacro MUI_PAGE_DIRECTORY
Page custom CreatePage
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

Section Install

SectionEnd

Function CreatePage
!insertmacro MUI_HEADER_TEXT "Set IP address" "Please input the IP address you want to set"
nsDialogs::Create 1018
Pop $0
${If} $0 == error
Abort
${EndIf}
${NSD_CreateLabel} 0u 2u 64u 8u "IP Address:"
${NSD_CreateIPaddress} 70u 0u 80u 12u ""
nsDialogs::Show
FunctionEnd
ducvinhbp is offline   Reply With Quote
Old 6th September 2020, 21:16   #10
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
PHP Code:
Page custom CreatePage PageLeave
...

var 
ipaddrhwnd
var ipaddr

Function CreatePage
...
${
NSD_CreateIPaddress70u 0u 80u 12u ""
Pop $ipaddrhwnd
nsDialogs
::Show
FunctionEnd 

Function PageLeave
${NSD_GetText$ipaddrhwnd $ipaddr
MessageBox mb_ok $ipaddr
FunctionEnd 

Section
SetOutPath $InstDir
WriteIniStr 
"$InstDir\config.ini" Server IP $ipaddr
SectionEnd 

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 7th September 2020, 03:13   #11
ducvinhbp
Junior Member
 
Join Date: Sep 2020
Posts: 16
Thank you so much for your help
ducvinhbp is offline   Reply With Quote
Old 7th September 2020, 06:41   #12
ducvinhbp
Junior Member
 
Join Date: Sep 2020
Posts: 16


i did a good job fixing the path to ini. My problem is how do I remove the text before the IP address "a ="
ducvinhbp is offline   Reply With Quote
Old 7th September 2020, 06:42   #13
ducvinhbp
Junior Member
 
Join Date: Sep 2020
Posts: 16


ducvinhbp is offline   Reply With Quote
Old 7th September 2020, 11:28   #14
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
You don't because that is the format of a ini file. You can't use WriteIniStr with the format you want.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 18th September 2020, 18:37   #15
ducvinhbp
Junior Member
 
Join Date: Sep 2020
Posts: 16


I cannot do as original installation file
ducvinhbp is offline   Reply With Quote
Old 18th September 2020, 22:11   #16
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
Are you saying you want to disable these controls? It is pointless, the user can override with /D on the commandline.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 19th September 2020, 08:33   #17
ducvinhbp
Junior Member
 
Join Date: Sep 2020
Posts: 16
locks the installation path selection when the file is installed
ducvinhbp is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump