Archive: Using Plugins , INI files


Using Plugins , INI files
Hi ppl,
I am new here and jst started using NSIS ,
Can anybody tell me how to insert components like List view, Selection box,etc.

Plz tell me with the example...


Create a custom page using InstallOptions. See Examples\InstallOptions for examples.


Hi thanks for that reply,
BTW mean while i've tried something which is pasted below..
Here I've pun an INI file but it is required to be under .onInit function,
now the issue is I dont want that component anitially , but in between , so what I should do ...



; Script generated by the HM NIS Edit Script Wizard.

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Stuff!"
!define PRODUCT_VERSION "1.0"
!define PRODUCT_PUBLISHER "Hobo Software"
!define PRODUCT_WEB_SITE "http://www.hobo.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\AppMainExe.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

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

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"

Page custom UserSerialNumberDialog

Function UserSerialNumberDialog
!insertmacro MUI_HEADER_TEXT "$(NAMEPAGEHERE_TITLE)" "$(NAMEPAGEHERE_SUBTITLE)"
# Display the page.
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "UserSerialNumberDialog"
FunctionEnd


; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
;!insertmacro MUI_PAGE_LICENSE "C:\Program Files\HMSoft\NIS Edit\NSIS Dialogs\License.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\Stuff.exe"
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "English"

Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "test1.ini" "UserSerialNumberDialog"
FunctionEnd
; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "$PROGRAMFILES\Stuff!"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show

Section "MainSection" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
;File "..\..\..\..\path\to\file\AppMainExe.exe"
CreateDirectory "$SMPROGRAMS\Stuff!"
CreateShortCut "$SMPROGRAMS\Stuff!\Stuff!.lnk" "$INSTDIR\AppMainExe.exe"
CreateShortCut "$DESKTOP\Stuff!.lnk" "$INSTDIR\AppMainExe.exe"
;File "..\..\..\..\path\to\file\Example.file"
SectionEnd

Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\Stuff!\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\Stuff!\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\AppMainExe.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\AppMainExe.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd


Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd

Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd

Section Uninstall
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\Example.file"
Delete "$INSTDIR\AppMainExe.exe"

Delete "$SMPROGRAMS\Stuff!\Uninstall.lnk"
Delete "$SMPROGRAMS\Stuff!\Website.lnk"
Delete "$DESKTOP\Stuff!.lnk"
Delete "$SMPROGRAMS\Stuff!\Stuff!.lnk"

RMDir "$SMPROGRAMS\Stuff!"
RMDir "$INSTDIR"

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd


Put the Page line in its appropriate position between the other page macros.


Hi, Thanks for that,

Can u show me it in given code...


No. Simply move the Page line in between !insertmacro MUI_PAGE_* lines. The order in which pages show is the order in which they are defined in the script. The MUI_PAGE_*, as do Page lines, define pages.


I have already tried it,
by doing so I get error as " "

Error: command InitPluginsDir not valid outside section or function
Error in macro MUI_INSTALLOPTIONS_EXTRACT_AS on macroline 5
Error in script "C:\Personica\Final Installer\final.nsi" on line 24 -- aborting creation process


Move the Page line, not the contents of the UserSerialNumberDialog or .onInit function. Move just the following line:

Page custom UserSerialNumberDialog

Originally posted by kulakshay
I have already tried it,
by doing so I get error as " "

Error: command InitPluginsDir not valid outside section or function
Error in macro MUI_INSTALLOPTIONS_EXTRACT_AS on macroline 5
Error in script "C:\Personica\Final Installer\final.nsi" on line 24 -- aborting creation process
an almost similar issue has been discussed at this thread:
http://forums.winamp.com/showthread....94#post2086494