Scoop-extras: Add NppShell.dll to notepad++

Created on 2 Feb 2018  路  16Comments  路  Source: lukesampson/scoop-extras

Add NppShell.dll to notepad++ to be able to add it to the Windows Explorer context menu:
http://docs.notepad-plus-plus.org/index.php/Explorer_Context_Menu

enhancement

Most helpful comment

Every time I update Notepad++ I go to the current folder and copy the NppShell.dll from the previous version.
I don't need to run the regsvr32, just copying it is enough because I already registered the DLL in the current folder (not a numeric version folder).
I don't think that scoop should register the DLL itself, just copying it would satisfy. The user must register the DLL the first time and scoop would take care of it from there.

All 16 comments

I have to say I'd be against adding this to the install, (unless it was some sort of option), as it makes the package less "portable" and means it requires admin to install. But I do think a discussion on app portability needs to be had.

The other option would be installing from the installer. Perhaps it could be named notepadplusplus-installer.json:
{ "homepage": "https://notepad-plus-plus.org/", "version": "7.5.4", "license": "GPL", "bin": "notepad++.exe", "checkver": "Current Version:.*?<span>(.*?)</span>", "installer": [ "args": [ "/S", "/D=\"$dir\"" ] ], "persist": [ "backup", "plugins", "config.xml", "session.xml" ], "shortcuts": [ [ "notepad++.exe", "Notepad++" ] ], "architecture": { "64bit": { "url": "https://notepad-plus-plus.org/repository/7.x/7.5.4/npp.7.5.4.Installer.x64.exe#/npp.exe", "hash": "sha1:f6f63a8c489410f465ddbbd2d90f6ba97f590b48" }, "32bit": { "url": "https://notepad-plus-plus.org/repository/7.x/7.5.4/npp.7.5.4.Installer.exe#/npp.exe", "hash": "sha1:c5b0205a3aa9ed2c15ad9788281a27c083b044b8" } }, "autoupdate": { "architecture": { "64bit": { "url": "https://notepad-plus-plus.org/repository/$majorVersion/$version/npp.$version.Installer.x64.exe#/npp.exe" }, "32bit": { "url": "https://notepad-plus-plus.org/repository/$majorVersion/$version/npp.$version.Installer.xe#/npp.exe" } }, "hash": { "url": "https://notepad-plus-plus.org/repository/$majorVersion.x/$version/npp.$version.sha1.md5.digest.txt" } } }

Why not creating a different package like notepadplusplus-pm.json called notepadplusplus-shell.json with the same logic?

@flavio20002 That certainly is another option.

Every time I update Notepad++ I go to the current folder and copy the NppShell.dll from the previous version.
I don't need to run the regsvr32, just copying it is enough because I already registered the DLL in the current folder (not a numeric version folder).
I don't think that scoop should register the DLL itself, just copying it would satisfy. The user must register the DLL the first time and scoop would take care of it from there.

I agree with @NemoStein that NppShell.dll should at least be included in the install. Then the install text could read something like:

To avoid needing administrator access, and to maintain portability, the notepadplusplus package
does not install explorer context options. To add context options, execute the following commands

cd %USERPROFILE%\scoop\apps\notepadplusplus\current
regsvr32 /i NppShell.dll

This will only need to be done once (since the DLL location will remain the same on update)

versus the current text which is:

The following page explains how to add explorer context menu entries for notepad++.
http://docs.notepad-plus-plus.org/index.php/Explorer_Context_Menu

That said, this is currently (at least for me) a moot point since the current version of that DLL won't register:

The module "NpShell.dll" was loaded but the call to
DllRegisterServer failed with error code 0x80004005.

For more information about this problem, search online using
the error code as a search term.

Bummer. Back to a normal msi install for the moment. I hate having non-scoop installs. :(

I just noticed that the vscode package handles this nicely with a clean message. Probably good to emulate: https://github.com/lukesampson/scoop-extras/blob/master/bucket/vscode.json#L8

@rwarren , that error may be because you didn't run regsvr32 as administrator?

How are we meant to be obtaining NppShell.dll in the first place? Manually download the .EXE installer from the npp site and extract the file from there, and repeat that every time there is an update (in case of bugfixes etc)?

We can use the installer file instead but it will be a little messy. Also there is two NppShell.dll file in the installer and I don't know which is the correct one. It would be much easy to add context menu with a reg file.

Sorry, I meant as an end user of scoop. The current note:

"The following page explains how to add explorer context menu entries for notepad++. https://npp-user-manual.org/docs/shell-extension"

is misleading as there is no NppShell.dll included with the package installed by scoop. So the only way one can complete the task is by manually downloading and extracting from the EXE installer. Perhaps the note should be updated to explain that better.

Also, the installer I downloaded yesterday (both the 32bit and 64bit versions) only had one NppShell.dll file in the parent directory.

It would be much easy to add context menu with a reg file.

How about this:

[HKCR\*\shell\EditWithNpp]
@="Edit with Notepad++"
[HKCR\*\shell\EditWithNpp\command]
@="\"C:\\Program Files (x86)\\Notepad++\\notepad++.exe\" "%1" %*"

https://github.com/notepad-plus-plus/notepad-plus-plus/issues/92#issue-77591148

This is handled well by VS Code and Vim using a .reg file stored in raw.githubusercontent.com. I just have to double-click on a .reg file the first time I install it and it keeps working through upgrades.

https://github.com/lukesampson/scoop-extras/blob/master/bucket/vscode.json
https://raw.githubusercontent.com/lukesampson/scoop-extras/master/scripts/vscode-install-context.reg

https://github.com/ScoopInstaller/Main/blob/master/bucket/vim.json
https://raw.githubusercontent.com/ScoopInstaller/Main/master/scripts/vim/install-context.reg

Can we get something similar for Notepad++, or let me know how submit a pull request that gets a .reg file into raw.githubusercontent.com and I'll take a stab at it myself?

You can add them here

Can we get something similar for Notepad++, or let me know how submit a pull request that gets a .reg file into raw.githubusercontent.com and I'll take a stab at it myself?

would be very much appreciated...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lx4r picture lx4r  路  8Comments

janpio picture janpio  路  13Comments

jahead picture jahead  路  11Comments

bickycheese picture bickycheese  路  24Comments

Bazalia picture Bazalia  路  13Comments