?
Solved

Nullsoft Installer (NSIS) Get Value and save to file.

Posted on 2014-04-09
5
Medium Priority
?
807 Views
Last Modified: 2014-05-12
I am working on an installer for specific tinc-vpn installations. I need to have nullsoft installer ask me for two things:

1. The VPN address
2. The name of the computer on the VPN network.

These values will be written to text files by the installer (that's a later step).

for now, I am trying to figure out how to access the vars once they have been put in.

Here's what I have so far:
!include LogicLib.nsh
!include nsDialogs.nsh

Name nsDialogs
OutFile nsDialogs.exe

XPStyle on

Var Dialog
Var Label1
Var Label2
Var IPAddr
Var VPNName

Page custom nsDialogsPage nsDialogsPageLeave
Page instfiles

Function nsDialogsPage
	nsDialogs::Create 1018
	Pop $Dialog
	
	${If} $Dialog == error
		Abort
	${EndIf}
	
	${NSD_CreateLabel} 0 0 100% 12u "What's Your IP Address on the VPN?"
	Pop $Label1
	
	${NSD_CreateText} 0 12u 100% 12u ""
	Pop $IPAddr
	
	${NSD_CreateLabel} 0 24u 100% 12u "What's Your IP Address on the VPN?"
	Pop $Label2
	
	${NSD_CreateText} 0 36u 100% 12u ""
	Pop $VPNName
	
	nsDialogs::Show
	
FunctionEnd

Function nsDialogsPageLeave
	${NSD_GetText} $VPNName $0
	DetailPrint "VPN Name: $0"
Function End

Section

SectionEnd

Open in new window


This, of course, fails in the compiler. Does anyone know how to make this work? I just want to do something simple: prompt for a text value, then store that text value in a text file, and copy that file to a desination...
0
Comment
Question by:DrDamnit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 39990527
Hi Michael,

The compile failure is due simply to a typo:

Function End should be FunctionEnd

That is, no space between the words — this will fix the compile problem and will now produce this:

nsis script fixedBut the second prompt should be something like this:

"What's Your Computer Name on the VPN Network?"

...instead of a second occurrence of:

"What's Your IP Address on the VPN?"

Regards, Joe
0
 
LVL 55

Accepted Solution

by:
Joe Winograd, EE MVE 2015&2016 earned 2000 total points
ID: 40007169
Hi Michael,
Just checking in to see where things stand on this. Regards, Joe
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 40040663
Michael,
Checking in again. What's the scoop? Regards, Joe
0
 
LVL 32

Author Comment

by:DrDamnit
ID: 40059456
I ultimately scrapped this and did it with VB script. But your answer was the correct one. Awarding points.
0
 
LVL 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
ID: 40059468
Thanks for the update...and for the points! Regards, Joe
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question