Old 30th June 2017, 22:16   #1
garyinaz
Junior Member
 
Join Date: Jun 2017
Posts: 3
Win 10 File associations

Hello - I am trying to register my portable OpenOffice apps on Win 10. What seemed like an easy task has me stumped! The apps are on drive P: (USB) and all I need to do is associate .odt; .odb; and .odg file types to the appropriate OpenOfficePortable.exe - e.g.

.odt to P:\OpenOfficePortable\OpenOfficeWriterPortable.exe

I've built a .nsi that includes FileAssociation.nsh, and tried both SetRegView to 32 and 64, but the ${RegisterExtension} "P:\OpenOfficePortable\OpenOfficeWriterPortable.exe" ".odt" "odt_file" changes nothing in the registry, even after a reboot.

I know I'm missing something here ... what?

Thanks for any help!
garyinaz is offline   Reply With Quote
Old 30th June 2017, 22:24   #2
garyinaz
Junior Member
 
Join Date: Jun 2017
Posts: 3
My .nsi script:

!include "FileAssociation.nsh"


Function .onInit
System::Call 'kernel32::CreateMutex(p 0, i 0, t "myMutex") p .r1 ?e'
Pop $R0

StrCmp $R0 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
Abort

MessageBox MB_YESNO "This will install PedsCare. Continue?" IDYES gogo
Abort
gogo:
FunctionEnd

Name "PedsCare"
OutFile "installer.exe"
SetFont /LANG=${LANG_ENGLISH} "Consolas" 18
Icon "P:\NSIS\Caduceus.ico"

Section "Installer Section"
SetRegView 64
${registerExtension} "P:\OpenOfficePortable\OpenOfficeDrawPortable.exe" ".odg" "odg_file"
${registerExtension} "P:\OpenOfficePortable\OpenOfficeWriterPortable.exe" ".odt" "odt_file"
${registerExtension} "P:\OpenOfficePortable\OpenOfficeBasePortable.exe" ".odb" "odb_file"

SetRegView 32
${registerExtension} "P:\OpenOfficePortable\OpenOfficeDrawPortable.exe" ".odg" "odg_file"
${registerExtension} "P:\OpenOfficePortable\OpenOfficeWriterPortable.exe" ".odt" "odt_file"
${registerExtension} "P:\OpenOfficePortable\OpenOfficeBasePortable.exe" ".odb" "odb_file"


SectionEnd
garyinaz is offline   Reply With Quote
Old 1st July 2017, 01:41   #3
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,529
Do you have "RequestExecutionLevel admin" in your script? FileAssociation.nsh tries to write to HKCR and you need to be admin to do that.

If you don't want to require UAC elevation then you must change all instances of HKCR ("HKCR $R0..." to "HKCU Sofware\Classes\$R0..." etc.) in FileAssociation.nsh.

Just keep in mind that Windows does not allow you to fully take over existing associations anymore, it might display a prompt when you try to open a file. See Changes to how Windows 10 handles default apps

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 1st July 2017, 05:10   #4
garyinaz
Junior Member
 
Join Date: Jun 2017
Posts: 3
SOLVED! "RequestExecutionLevel admin" did the trick - thanks Anders
garyinaz is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump