Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 18th July 2012, 23:48   #1
mysousa
Junior Member
 
Join Date: Jul 2012
Posts: 2
Simple Installer - Just want to provide an option.

Hello. I am new and have poured through the docs trying to understand this software. Please help me achieve a simple goal.

I want:
page 1 - Welcome, blah blah
page 2 - Please choose A or B
page 3 - install
If chose A install file A
If chose B install file B

How do I set up this option.

I am this far.
code:
; Install templates for printing.

!define PRODUCT_NAME "Template Installer"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "MCID"
!define PRODUCT_WEB_SITE "http://www.mycompany.com"

;--------------------------------

Name "Template Installer"

; Output executable
OutFile "template_installer.exe"

; Request application privileges
RequestExecutionLevel user

;--------------------------------

; Pages

Page instfiles

;--------------------------------

; The stuff to install
Section "" ;No components page, name is not important

; Set context to All Users
SetShellVarContext all

; Set output path to the installation directory.
SetOutPath "$AppData\IDsPlus\Design Files\"

; Files to put
File globals.gdx

SectionEnd ; end the section


This works, it writes the file where I want it. I cannot figure out how to set up an options page.

I have also done this using HM NIS Edit:
code:
; Ini file generated by the HM NIS Edit IO designer.
[Settings]
NumFields=2

[Field 1]
Type=RadioButton
Text="Install for direct-to-card printer"
Left=21
Right=350
Top=28
Bottom=40

[Field 2]
Type=RadioButton
Text="Install for retransfer printer"
Left=21
Right=352
Top=43
Bottom=52


I have no idea how to incorporate this or if I am barking up the wrong tree.

Please help.
mysousa is offline   Reply With Quote
Old 19th July 2012, 03:12   #2
mysousa
Junior Member
 
Join Date: Jul 2012
Posts: 2
[Solved]

Okay, I got it. Boy, this stuff is difficult when foreign. I had come to think, over the past few weeks, this would be insurmountable. I got it. For anybody curious, here was the solution.

team_credential_template_installer.nsddef
code:
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file was created by NSISDialogDesigner 0.9.16.0
http://coolsoft.altervista.org/nsisdialogdesigner
Do not edit manually!
-->
<Dialog Name="team_credential_template_installer" Title="Team Credential Template Installer" Subtitle="Install template files for printing credentials.">
<Label Name="Text" Location="23, 15" Size="398, 34" Text="Please choose the correct templates to install based on your printer type." TabIndex="0" />
<RadioButton Name="CR80" Location="19, 98" Size="402, 40" Text="Direct-to-Card***xD;***xA;(Datacard CP80 Plus, EDISecure DCP350, Fargo DTC1000, etc)" TabIndex="1" onClick="fnc_install_CR80" />
<RadioButton Name="OverCR80" Location="19, 52" Size="402, 40" Text="Retransfer***xD;***xA;(EDISecure XID 8300 or similar)" Checked="True" TabIndex="2" onClick="fnc_install_overCR80" />
</Dialog>



team_credential_template_installer.nsdinc
code:
; ========================================================
; This file was generated by NSISDialogDesigner 0.9.16.0
; http://coolsoft.altervista.org/nsisdialogdesigner
; ========================================================

; handle variables
Var hCtl_team_credential_template_installer
Var hCtl_team_credential_template_installer_Text
Var hCtl_team_credential_template_installer_CR80
Var hCtl_team_credential_template_installer_OverCR80


; dialog create function
Function fnc_team_credential_template_installer_Create

; === team_credential_template_installer (type: Dialog) ===
nsDialogs::Create 1018
Pop $hCtl_team_credential_template_installer
${If} $hCtl_team_credential_template_installer == error
Abort
${EndIf}
!insertmacro MUI_HEADER_TEXT "Team Credential Template Installer" "Install template files for printing credentials."

; === Text (type: Label) ===
${NSD_CreateLabel} 15u 8u 261u 19u "Please choose the correct templates to install based on your printer type."
Pop $hCtl_team_credential_template_installer_Text

; === CR80 (type: RadioButton) ===
${NSD_CreateRadioButton} 12u 55u 264u 23u "Direct-to-Card$\r$\n(Datacard CP80 Plus, EDISecure DCP350, Fargo DTC1000, etc)"
Pop $hCtl_team_credential_template_installer_CR80
${NSD_AddStyle} $hCtl_team_credential_template_installer_CR80 ${WS_GROUP}
${NSD_OnClick} $hCtl_team_credential_template_installer_CR80 fnc_install_CR80

; === OverCR80 (type: RadioButton) ===
${NSD_CreateRadioButton} 12u 29u 264u 23u "Retransfer$\r$\n(EDISecure XID 8300 or similar)"
Pop $hCtl_team_credential_template_installer_OverCR80
${NSD_OnClick} $hCtl_team_credential_template_installer_OverCR80 fnc_install_overCR80
${NSD_Check} $hCtl_team_credential_template_installer_OverCR80

FunctionEnd


; dialog show function
Function fnc_team_credential_template_installer_Show
Call fnc_team_credential_template_installer_Create
nsDialogs::Show $hCtl_team_credential_template_installer
FunctionEnd



and finally, team_credential_template_installer.nsi
code:
; Install templates for printing.

!define PRODUCT_NAME "team Credential Template Installer"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "Midwest Card and ID Solutions"
!define PRODUCT_WEB_SITE "http://www.midwestcard.com"

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"

; Output executable
OutFile "team_credential_template_installer.exe"

; Request application privileges
RequestExecutionLevel user

;--------------------------------

; MUI 1.67 compatible ------
!include "MUI.nsh"

; includes
!include nsdialogs.nsh
!include "team_credential_template_installer.nsdinc"
!include LogicLib.nsh

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "MCID_vector_based_logo.ico"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE 'license_info.txt'
; Custom Page
Page custom fnc_team_credential_template_installer_Show
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH

; Language files
!insertmacro MUI_LANGUAGE "English"

; Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

; MUI end ------

;--------------------------------

Var install_CR80
Var install_overCR80

Function fnc_install_CR80
StrCpy $install_CR80 "1"
FunctionEnd

Function fnc_install_overCR80
StrCpy $install_overCR80 "1"
FunctionEnd

; The stuff to install
Section "Template Installation"

; default value based on most printers in area
StrCpy $install_overCR80 "1"

; Set context to All Users
SetShellVarContext all

; Set output path to the installation directory for ID Centre.
SetOutPath "$DOCUMENTS\Datacard\ID Software\Projects\TraxPersonnel\"

${if} $install_CR80 == "1"
; MessageBox MB_OK "CR80 $install_CR80"
; Files to put
File /r temp_CR80\TraxPersonnel\*.*
${elseif} $install_overCR80 == "1"
; MessageBox MB_OK "overCR80 $install_overCR80"
; Files to put
File /r temp_overCR80\TraxPersonnel\*.*
${endif}

; Set output path to the installation directory for ID Designer.
SetOutPath "$AppData\company\IDsPlus\Design Files\"

; Files to put
File /r temp\*.*

SectionEnd ; end the section

mysousa is offline   Reply With Quote
Old 19th July 2012, 05:16   #3
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,841
If you're using nsDialogs anyway, you should use MUI2 instead of MUI. You can then also remove the MUI_RESERVEFILE_INSTALLOPTIONS macro.
MSG is offline   Reply With Quote
Old 19th July 2012, 10:01   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
Yes just for clarity MUI2 uses nsDialogs instead of InstallOptions for its welcome and finish pages. Your new dialog is built using nsDialogs and therefore you are adding additional overhead by using MUI1 (InstallOptions). Change !include MUI.nsh to !include MUI2.nsh and remove !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp 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