Add app to Window's "Open With" suggestions for text files (#475)

Closes #472
This commit is contained in:
dail8859
2023-11-09 11:25:38 -05:00
committed by GitHub
parent f96bacc07e
commit ccbd348486

View File

@@ -182,14 +182,15 @@ Section "Notepad Next"
SetRegView 64
# Register the application (e.g. cmd> start notepadnext)
# Register the application. https://learn.microsoft.com/en-us/windows/win32/shell/app-registration#registering-applications
WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\App Paths\NotepadNext.exe" "" "$INSTDIR\NotepadNext.exe"
# Register 'Open With' menu suggestion. No real good documentation for this. https://stackoverflow.com/a/62783311
WriteRegStr SHCTX "Software\Classes\NotepadNext\shell" "" "open"
WriteRegStr SHCTX "Software\Classes\NotepadNext\shell\open\command" "" "$\"$INSTDIR\NotepadNext.exe$\" $\"%1$\""
WriteRegStr SHCTX "Software\Classes\.txt\OpenWithProgids" "NotepadNext" ""
# TODO: add more extensions
# Register verbs. https://learn.microsoft.com/en-us/windows/win32/shell/app-registration#registering-verbs-and-other-file-association-information
WriteRegStr SHCTX "Software\Classes\Applications\NotepadNext.exe\shell\open\command" "" "$\"$INSTDIR\NotepadNext.exe$\" $\"%1$\""
WriteRegStr SHCTX "Software\Classes\Applications\NotepadNext.exe\shell\edit\command" "" "$\"$INSTDIR\NotepadNext.exe$\" $\"%1$\""
# Register it the perceived type so that Windows will suggest it as a possible application to use
WriteRegStr SHCTX "Software\Classes\SystemFileAssociations\text\OpenWithList\NotepadNext.exe" "" ""
WriteUninstaller "$INSTDIR\uninstall.exe"
!insertmacro MULTIUSER_RegistryAddInstallInfo
@@ -304,12 +305,11 @@ Section "Uninstall"
# Remove application registration
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\App Paths\NotepadNext.exe" "" "$INSTDIR\NotepadNext.exe"
# Custom configurations
DeleteRegKey SHCTX "Software\NotepadNext\"
# Remove registered verbs
DeleteRegKey SHCTX "Software\Classes\Applications\NotepadNext.exe"
# Remove type registration
DeleteRegKey SHCTX "Software\Classes\SystemFileAssociations\text\OpenWithList\NotepadNext.exe"
# Remove 'Open With' menu suggestion
DeleteRegValue SHCTX "Software\Classes\.txt\OpenWithProgids" "NotepadNext"
DeleteRegKey SHCTX "Software\Classes\NotepadNext"
!insertmacro MULTIUSER_RegistryRemoveInstallInfo
SectionEnd