Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 12th December 2011, 12:22   #1
berkyr
Junior Member
 
Join Date: Dec 2011
Posts: 1
Portable and Install mode in one installer

how to create two install methods in one installer ?
like AIMP installer http://iceimg.com/i/ea/7c/2e7128d925.png

i need when select Install mode - app install to "$INSTDIR"
and when select Portable mode - extract files to "$EXEDIR" or custom install path

can anybody explain on my example whats need more to be complete ?
Quote:
; Script generated by the HM NIS Edit Script Wizard.

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "Registry Winner"
!define PRODUCT_VERSION "6.4.12.12"
!define PRODUCT_PUBLISHER "RegistryWinner.com"
!define PRODUCT_WEB_SITE "http://www.registrywinner.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\RegistryWinner.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "RegistryWinner v6.4.exe"
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
InstallDir "$PROGRAMFILES\Registry Winner"
Icon "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
DirText "Setup will install $(^Name) in the following folder.$\r$\n$\r$\nTo install in a different folder, click Browse and select another folder."
LicenseText "If you accept all the terms of the agreement, choose I Agree to continue. You must accept the agreement to install $(^Name)."
LicenseData "lic.rtf"
LicenseForceSelection radiobuttons

SetCompressor /SOLID lzma
SetCompressorDictSize 128
SetDatablockOptimize on
ShowInstDetails show
ShowUninstDetails show


Section "MainSection" SEC01
SetOutPath "$INSTDIR\Language"
SetOverwrite try
File "Registry_Winner\RegistryWinner_Setup\{app}\Language\English.ini"
File "Registry_Winner\RegistryWinner_Setup\{app}\Language\Italian.ini"
File "Registry_Winner\RegistryWinner_Setup\{app}\Language\Romanian.ini"
File "Registry_Winner\RegistryWinner_Setup\{app}\Language\Russian.ini"
SetOutPath "$INSTDIR"
File "Registry_Winner\RegistryWinner_Setup\{app}\License.txt"
;File "Registry_Winner\RegistryWinner_Setup\{app}\manual.chm"
File "Registry_Winner\RegistryWinner_Setup\{app}\RegistryWinner.exe"
File "Registry_Winner\RegistryWinner_Setup\{app}\reg.ini"
CreateDirectory "$SMPROGRAMS\Registry Winner"
CreateShortCut "$SMPROGRAMS\Registry Winner\Registry Winner.lnk" "$INSTDIR\RegistryWinner.exe"
CreateShortCut "$DESKTOP\Registry Winner.lnk" "$INSTDIR\RegistryWinner.exe"
File "Registry_Winner\RegistryWinner_Setup\{app}\RWCleaner.dll"
File "Registry_Winner\RegistryWinner_Setup\{app}\RWJunk.dll"
File "Registry_Winner\RegistryWinner_Setup\{app}\RWOptimizer.dll"
File "Registry_Winner\RegistryWinner_Setup\{app}\Settings.ini"
;SetOutPath "$INSTDIR\skins"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\localSetting.ini"
;SetOutPath "$INSTDIR\skins\skin10"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\BTN_CHANGE_SKIN_HOVER.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\BTN_CHANGE_SKIN_NORMAL.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\btn_top_help_1.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\btn_top_help_2.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\btn_top_register_1.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\btn_top_register_2.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\btn_top_update_1.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\btn_top_update_2.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\CloseButton_Hover.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\CloseButton_Normal.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\desc_home_options.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\imglist_folder.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\mainFrame-bottom.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\mainFrame-centerLeft.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\mainFrame-centerMid.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\mainFrame-centerRight.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\mainFrame_top.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\min1.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\min2.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\scannow1.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\scannow2.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\splash.bmp"
;File "Registry_Winner\RegistryWinner_Setup\{app}\skins\skin10\thumbnail.bmp"
SectionEnd

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

Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\RegistryWinner.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\RegistryWinner.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\skins\skin10\thumbnail.bmp"
;Delete "$INSTDIR\skins\skin10\splash.bmp"
;Delete "$INSTDIR\skins\skin10\scannow2.bmp"
;Delete "$INSTDIR\skins\skin10\scannow1.bmp"
;Delete "$INSTDIR\skins\skin10\min2.bmp"
;Delete "$INSTDIR\skins\skin10\min1.bmp"
;Delete "$INSTDIR\skins\skin10\mainFrame_top.bmp"
;Delete "$INSTDIR\skins\skin10\mainFrame-centerRight.bmp"
;Delete "$INSTDIR\skins\skin10\mainFrame-centerMid.bmp"
;Delete "$INSTDIR\skins\skin10\mainFrame-centerLeft.bmp"
;Delete "$INSTDIR\skins\skin10\mainFrame-bottom.bmp"
;Delete "$INSTDIR\skins\skin10\imglist_folder.bmp"
;Delete "$INSTDIR\skins\skin10\desc_home_options.bmp"
;Delete "$INSTDIR\skins\skin10\CloseButton_Normal.bmp"
;Delete "$INSTDIR\skins\skin10\CloseButton_Hover.bmp"
;Delete "$INSTDIR\skins\skin10\btn_top_update_2.bmp"
;Delete "$INSTDIR\skins\skin10\btn_top_update_1.bmp"
;Delete "$INSTDIR\skins\skin10\btn_top_register_2.bmp"
;Delete "$INSTDIR\skins\skin10\btn_top_register_1.bmp"
;Delete "$INSTDIR\skins\skin10\btn_top_help_2.bmp"
;Delete "$INSTDIR\skins\skin10\btn_top_help_1.bmp"
;Delete "$INSTDIR\skins\skin10\BTN_CHANGE_SKIN_NORMAL.bmp"
;Delete "$INSTDIR\skins\skin10\BTN_CHANGE_SKIN_HOVER.bmp"
;Delete "$INSTDIR\skins\localSetting.ini"
Delete "$INSTDIR\Settings.ini"
Delete "$INSTDIR\RWOptimizer.dll"
Delete "$INSTDIR\RWJunk.dll"
Delete "$INSTDIR\RWCleaner.dll"
Delete "$INSTDIR\RegistryWinner.exe"
;Delete "$INSTDIR\manual.chm"
Delete "$INSTDIR\License.txt"
Delete "$INSTDIR\reg.ini"
Delete "$INSTDIR\Language\Russian.ini"
Delete "$INSTDIR\Language\Romanian.ini"
Delete "$INSTDIR\Language\Italian.ini"
Delete "$INSTDIR\Language\English.ini"

Delete "$SMPROGRAMS\Registry Winner\Uninstall.lnk"
Delete "$SMPROGRAMS\Registry Winner\Website.lnk"
Delete "$DESKTOP\Registry Winner.lnk"
Delete "$SMPROGRAMS\Registry Winner\Registry Winner.lnk"

RMDir "$SMPROGRAMS\Registry Winner"
;RMDir "$INSTDIR\skins\skin10"
;RMDir "$INSTDIR\skins"
RMDir "$INSTDIR\Language"
RMDir "$INSTDIR"

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd
and yes, i see http://nsis.sourceforge.net/Common_I...ponents_Choice
but not understanding

sorry for my english
berkyr 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