Installing chrome extension from NSIS installer?

北慕城南 提交于 2019-12-05 01:43:22

问题


I have an application that also has a firefox and chrome extension. I am using NSIS for the installer, now I want the installer to have checkboxs asking if the user want to install the extension for his browser.

To install the firefox extension it's easy I just copy the extension files to PROGRAMFILES\Mozilla Firefox\extensions{GUID}, but I couldn't find a way I could do it for chrome (from the NSIS installer).

Does someone knows how to achieve this?


Update:

External Extensions

Thanks what I needed. (I couldn't answer my own question yet because I have to wait 8 hours for not having 100 rep)


回答1:


!define PRODUCT_VERSION "1.0.0"
!define CRXNAME "extension.crx"
!define CRXID "qwertyuiopasdfghjklzxcvbnm"

SetOutPath "$INSTDIR"
File "${CRXNAME}"  
WriteRegStr HKLM "Software\Google\Chrome\Extensions\${CRXID}" "path" "$INSTDIR\${CRXNAME}"
WriteRegStr HKLM "Software\Google\Chrome\Extensions\${CRXID}" "version"     "${PRODUCT_VERSION}"
WriteRegStr HKLM "Software\Wow6432Node\Google\Chrome\Extensions\${CRXID}" "path" "$INSTDIR\${CRXNAME}"
WriteRegStr HKLM "Software\Wow6432Node\Google\Chrome\Extensions\${CRXID}" "version" "${PRODUCT_VERSION}"



回答2:


The only way I could think of is to open Chrome for the user at the specific URL where the extension is located. Of course some user instructions beforehand. A more evil way would be to do the SendKey events for the user. Depends how much "dancing with the devil" you are up for ;)



来源:https://stackoverflow.com/questions/8535429/installing-chrome-extension-from-nsis-installer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!