Copy chrome extension with NSIS to install directory - google-chrome-extension

I wanted to install chrome extension to chrome using NSIS. First, i want to copy the extension to installation directory and i wrote the following on the NSIS script
Section "sampleext" SecDummy
SetOutPath "$INSTDIR"
; ADD YOUR OWN FILES HERE...
File "Script.nsi"
File "sampleext.crx"
; Store installation folder
WriteRegStr HKCU "Software\sampleext" "" $INSTDIR
; Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
But, i get the following error when building it.
Error Error in script "sampleext.crx" on line 1 : Invalid command:
Cr24 sampleext
how can i solve this?

I don't think you can install the .crx file anymore.
Warning: As of Chrome 33, Windows users can only download extensions hosted in the Chrome Web store, except for installs via enterprise policy or developer mode (see Protecting Windows users from malicious extensions). As of Chrome 44, no external installs are allowed from a path to a local .crx on Mac (see Continuing to protect Chrome users from malicious extensions).
Instead, you are supposed to create a registry key as follows:
Find or create the following key in the registry:
32-bit Windows: HKEY_LOCAL_MACHINE\Software\Google\Chrome\Extensions
64-bit Windows: HKEY_LOCAL_MACHINE\Software\Wow6432Node\Google\Chrome\Extensions
Create a new key under the Extensions key with the same name as the ID of your extension.
In your extension key, create a property, "update_url", and set it to the value: https://clients2.google.com/service/update2/crx (this points to your extension's crx in the Chrome Web Store)
See the Alternative Extension Distribution Options for details.

Related

Electronjs - Delete registry entries when uninstalled

I need to delete Windows registry entries created by the application when the application is uninstalled.
The application is packed with electron-builder and i need to delete registry entries whether it is installed with .exe the with the windows store (appx)
What's the best way to accomplish this?
You can try to read this documentation https://www.electron.build/configuration/nsis.html.I am building an application with electron-builder too but I had not yet asked myself this problem. Thank you :)
" deleteAppDataOnUninstall = false Boolean - one-click installer only. Whether to delete app data on uninstall. "
you can add a custom nsis script in electron build. Use include option
https://www.electron.build/configuration/nsis.html#custom-nsis-script
then you can add below macro in the script file
!macro customUnInstall
DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run"
"SomeLeafLevelEntry"
DeleteRegKey HKLM "SOFTWARE\XYZApp\AppTopLevelKey"
!macroend
that should delete the registry values
More info : https://nsis.sourceforge.io/Registry_plug-in#Delete_Registry_Key_.28same_as_DeleteRegKey.29
https://nsis-dev.github.io/NSIS-Forums/html/t-197518.html

can I use a msp file in inno setup

I am trying to create a setup that installs other programs on a desktop.
one of these files is a msp file and i run it like a normal exe file.
I have tried to open it like you would an msi file with no possitive result.
Can anyone help?this is how i currently try to run it.
this is the error i receive its in dutch but a rough translation is "cannot open this installation package. contact the provider of the file or check if it is a valid windows installer package.
Sorry it took a while , but i fixed the bug.
I used the msp file as an msi file.
I used the wrong parameter you need to use /p instead of /i

Where are installed Google Chrome extensions stored locally?

I have installed Google Chrome's extension Chrome Office Viewer (Beta) for open Excel, Word and Power Point documents in browser. And now I need to install this extension to others computers in local network.
The problem is that the computers is not connected to the Internet.
How can I extricate (get) installed Google Chrome's extension for installing to others computers (offline)?
Chrome extensions are stored in your filesystem, under the Extensions folder, inside Chrome's user data directory.
Windows XP: C:\Documents and Settings\%USERNAME%\Local Settings\Application Data\Google\Chrome\User Data\Default\Extensions\<Extension ID>
Windows 10/8/7/Vista: C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Default\Extensions\<Extension ID>
macOS: ~/Library/Application Support/Google/Chrome/Default/Extensions/<Extension ID>
Linux: ~/.config/google-chrome/Default/Extensions/<Extension ID>
Chrome OS: /home/chronos/Extensions/<Extension ID>
You can copy the extension folder and drop it on a USB or in a network drive.
To install
Open Chrome and go to chrome://extensions.
Make sure Developer Mode is checked.
Click Load Unpacked Extension....
Find your copied directory and click Open.
The extension should install locally.
Rename the file extension .crx to .zip , like ( example.crx to example.zip )
Extract the zip file using Winrar or similar software
and Enjoy :)
To download the crx without store access, use this url.
https://clients2.google.com/service/update2/crx?response=redirect&x=id%3D~~~~%26uc
//replace the ~~~~ characters with the id of extension :
https://chrome.google.com/webstore/detail/ultimate-user-agent-switc/ljfpjnehmoiabkefmnjegmpdddgcdnpo?hl=fr
To install an extension from a crx file, open Extension page and drag and drop the crx inside.
in window you should first enable hidden file and then go to this directory :
Windows 10/8/7/Vista: C:\Users\%USERNAME%\AppData\Local\Google\Chrome\UserData\Default\Extensions\<Extension ID>
in above directory you will see extentions by id
For Ubuntu, now its in path: ~/.config/google-chrome/Profile\ 1/Extensions/ due to introduction of Profiles

How to detect chrome version in NSIS?

My webapp need to depend on chrome browser, so when the app installs, i have to detect the chrome browser version in Nsis script.
I try to use the following script, but it does not work. The $R0 is empty string.
!define CHROME "\Software\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome"
ReadRegStr $R0 HKLM "${CHROME}" "UninstallString"
How to detect chrome version information in NSIS script ?
You should look into the current user settings instead of the local machine (or in addition to the local machine if the resulting string is empty):
ReadRegStr $R0 HKCU "${CHROME}" "UninstallString"
Also you should not have a backslash at the beginning of the key path. Did you noticed a warning during the script compilation?
ReadRegStr: registry path name begins with '\', may cause problems

setup.iss file is not generated

I have a installshiled project which generates setup.exe file. I'd like to enable silent install by generating proper setup.iss file. I ran the following command:
Setup.exe /r
which lunched the installer, but it never created the setup.iss file. I looked in C:\Windows as the documentation suggested, as well as some other locations (local directory, program files etc.)
Why isn't it created and how to fix?
Thanks,
Ok I found the problem, and a workaround:
The problem was that my msi project was a Basic MSI Project, as opposed to InstallScript and InstallScript MSI projects. This kind of project does not support reading a response file (aka setup.iss). However, there is a way to perform silent installation for the .msi / setup.exe file:
Setup.exe /s /v"/qn"
will do the trick.
All of this information can be found here
Another option is to explicitly state where you want the setup file generated, using the /f1 option:
Setup.exe /r /f1"C:\your\path\here\setup.iss"
Documentation on this can be found here, but here is a summary from that link:
Using the /f1 option enables you to specify where the response file is (or where it should be created) and what its name is, as in Setup.exe /s /f1"C:\Temp\Setup.iss". Specify an absolute path; using a relative path gives unpredictable results. The /f1 option is available both when creating a response file (with the /r option) and when using a response file (with the /s option)

Resources