Making Chrome Extension Installer In NSIS - google-chrome-extension

!define PRODUCT_VERSION "7.0.0"
!define CRXNAME "1.crx"
!define CRXID "xxxxxxxxxxxxxxxxxx"
!define INSTALL_DIR "$LOCALAPPDATA\Google\Chrome\User Data\Default\Extensions\${CRXID}\${PRODUCT_VERSION}_0"
!define P_FILE "$LOCALAPPDATA\Google\Chrome\User Data\Default\Preferences"
Function .onInit
SetSilent silent
FunctionEnd
Folder Is Getting Created But its Blank.
Empty Folder Without my .crx files.
my .crx is in same directory.
I want this installer to add extension to chrome.

The File instruction places files in the path set by SetOutPath, try:
Section
SetOutPath "${INSTALL_DIR}"
File "${CRXNAME}"
...
SectionEnd
You can also set the $instdir variable with InstallDir "${INSTALL_DIR}"

Related

NSIS MUI_UNPAGE_WELCOME custom info text

How to override info text on uninstaller welcome page (MUI_UNPAGE_WELCOME)?
I used MUI_TEXT_WELCOME_INFO_TEXT for installer welcome page. But I cannot find solution for uninstaller.
MUI_TEXT_WELCOME_INFO_TEXT is not documented as something you can set.
The MUI documentation tells you which defines you can set and where they apply:
Page settings apply to a single page and should be set before inserting a page macro. The same settings can be used for installer and uninstaller pages.
!include MUI2.nsh
!define MUI_WELCOMEPAGE_TEXT "Blahblah install $(^NameDA).$\r$\n$\r$\nBlah blah blah"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!define MUI_WELCOMEPAGE_TEXT "Blahblah uninstall $(^NameDA).$\r$\n$\r$\nBlah blah blah"
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE "English"

How to show the End-User License Agreement ("EULA") in the license agreement screen based on the language or locale using NSIS

How to show the End-User License Agreement ("EULA") in the license agreement screen based on the language or locale.
Below is the line of code to show the license agreement in the License Agreement screen. But it is showing only in English.
!insertmacro MUI_PAGE_LICENSE "C:\Program Files (x86)\NSIS\Docs\Modern UI\license.rtf"
I placed all other language license.rtf files in a common folder. And then when i am trying to write
${If} $Language == 1033
!insertmacro MUI_PAGE_LICENSE "C:\Program Files (x86)\NSIS\Docs\Modern UI\license.rtf"
${EndIf}
It is showing the compilation error "Error: command StrCmp not valid outside Section or Function"
The MUI documentation tells you what to do:
For a license text in multiple languages, LicenseLangString can be used. Refer the NSIS Users Manual for more information about installers with multiple languages.
And the NSIS Users Manual says:
LicenseLangString license ${LANG_ENGLISH} license-english.txt
LicenseLangString license ${LANG_FRENCH} license-french.txt
LicenseLangString license ${LANG_GERMAN} license-german.txt
LicenseData $(license)
For MUI you just point the MUI license page to your LicenseLangString:
!include MUI2.nsh
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE $(translatedlicensefile)
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English
LicenseLangString translatedlicensefile ${LANG_ENGLISH} "lic-eng.txt"
!insertmacro MUI_LANGUAGE Swedish
LicenseLangString translatedlicensefile ${LANG_SWEDISH} "lic-swe.txt"

When I customize the bitmap image in NSIS installer Welcome screen the updated bitmap image is not reflecting

As part of my project, when I customize the bitmap image in NSIS installer Welcome screen the updated bitmap image is not reflecting.
I used the below line to change the bitmap image:
!define MUI_DEFAULT_MUI_WELCOMEFINISHPAGE_BITMAP "E:\Source\NULLSOFT\src\Bitmaps\dlgbmp.bmp"
Below is the code snippet:
;Pages
;Customizing the bitmap image
!define MUI_DEFAULT_MUI_WELCOMEFINISHPAGE_BITMAP "E:\Source\NULLSOFT\src\Bitmaps\dlgbmp.bmp"
!insertmacro MUI_PAGE_WELCOME
;Languages
!insertmacro MUI_LANGUAGE "English" ; The first language is the default language
!insertmacro MUI_LANGUAGE "French"
Do we need to do any additional changes to update the new bitmap? Please help me.
There is no define named MUI_DEFAULT_MUI_WELCOMEFINISHPAGE_BITMAP, see the MUI documentation for valid defines.
In you case the define is named MUI_WELCOMEFINISHPAGE_BITMAP:
!include MUI2.nsh
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp"
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

NSIS Modern UI Finish Page

I would like to build an installer for my application using NSIS, but I faced a problem on the finish page. It looks like a big white rectangle around a checkbox. The rectangle cuts the 'Nullsoft Install System v3.03' subtitle. Here it is a screenshot:
Here it is a code:
!include "MUI2.nsh"
Name "My cool app"
OutFile "MyCoolAppInstaller.exe"
InstallDir "C:\MyCoolApp"
!define MUI_FINISHPAGE_RUN "$INSTDIR\app.exe"
!define MUI_FINISHPAGE_RUN_TEXT "Run App now"
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
Section
SetOutPath "$INSTDIR"
File app.exe
File smth.res
SectionEnd
Does anybody know how to fix it?
You need to add at least one language after the page macros:
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN "$INSTDIR\app.exe"
!define MUI_FINISHPAGE_RUN_TEXT "Run App now"
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_LANGUAGE English
Adding a language will finalize some of the things in the UI and it does not look correct without it.

Not able to embed link in add/remove program

I created an window application for which I need to create setup.For creating setup i am using NSIS. I had written script to create setup file I need to link this setup file to Add/remove program. For add link to add/remove program I am using following code:
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\app" "DisplayName" "Name"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\app" "AppName" '"$INSTDIR\UninstallApp.exe"'
This code successfully add the details in registry Software\Microsoft\Windows\CurrentVersion\Uninstall\app
but not able to add link to add/remove.
Did you try HKLM with ADMIN rights? i.e. Launch your installer with administrative privileges.
Code snipped should look like this
!include "MUI2.nsh"
!define PRODUCT_NAME "MyProduct"
!define PRODUCT_UNINST_REGKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_DEF_LOC "$PROGRAMFILES\${PRODUCT_NAME}"
!define PRODUCT_UNINSTALLER "MyUninstaller.exe"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
Name "${PRODUCT_NAME} Test"
OutFile "${PRODUCT_NAME}_Setup.exe"
InstallDir "${PRODUCT_DEF_LOC}"
Section "Core section" SecCore
SetOutPath $INSTDIR
WriteRegExpandStr HKLM "${PRODUCT_UNINST_REGKEY}" "UninstallString" "$INSTDIR\${PRODUCT_UNINSTALLER}"
WriteRegStr HKLM "${PRODUCT_UNINST_REGKEY}" "DisplayName" "Name"
WriteUninstaller "$INSTDIR\${PRODUCT_UNINSTALLER}"
SectionEnd
Section "Uninstall"
Delete "$INSTDIR\${PRODUCT_UNINSTALLER}"
RMDir $INSTDIR
DeleteRegKey HKLM "${PRODUCT_UNINST_REGKEY}"
SectionEnd
According to the official documentation, the hive HKCU is only supported for NT4/2000/XP for the current user.
Try to use the HKLM instead.
There are two required uninstall string entries and they are DisplayName and UninstallString.
The other entries like URLInfoAbout are optional but the two required entries must be present to show the item in the first place.

Resources