- NSIS Discussion
- .nsi extention not registered!
Archive: .nsi extention not registered!
mdlazreg
24th April 2004 22:59 UTC
.nsi extention not registered!
I have two windows machines both of them are XP (one home one at work). When I installed NSIS on both of them however only one of them could register the .nsi extention to be able to automatically open it with notepad.exe. The other machine (at work) could not!.
Any ideas what difference could have trigered this behaviour?
Thanks a lot!
Joost Verburg
24th April 2004 23:30 UTC
The .nsi extension was probably already registered by another tool.
mdlazreg
24th April 2004 23:45 UTC
Thanks Joost for your reply.
I can garantie to you that it was not. My computer did not know anything about .nsi before I installed NSIS.
Joost Verburg
25th April 2004 00:14 UTC
So there is no .nsi key in the HKEY_CLASSES_ROOT registry hive at all?
tommy916
25th April 2004 05:13 UTC
Right click the file of .nsi, choose "Open with" > "Choose Program" > Select the program from a list > Checkbox "Always use the selected program to open this kind of file". I use TextPad to open.
or re-install again.
VegetaSan
25th April 2004 12:43 UTC
maybe you should try this .. got it from the NSIS example:
Outfile "RegNSI.exe"
Name "REGISTER :)"
Section
ReadRegStr $R0 HKCR ".nsi" ""
StrCmp $R0 "NSISFile" 0 +2
DeleteRegKey HKCR "NSISFile"
WriteRegStr HKCR ".nsi" "" "NSIS.Script"
WriteRegStr HKCR "NSIS.Script" "" "NSIS Script File"
WriteRegStr HKCR "NSIS.Script\DefaultIcon" "" "$INSTDIR\makensisw.exe,1"
ReadRegStr $R0 HKCR "NSIS.Script\shell\open\command" ""
StrCmp $R0 "" 0 no_nsiopen
WriteRegStr HKCR "NSIS.Script\shell" "" "open"
WriteRegStr HKCR "NSIS.Script\shell\open\command" "" 'notepad.exe "%1"'
no_nsiopen:
WriteRegStr HKCR "NSIS.Script\shell\compile" "" "Compile NSIS Script"
WriteRegStr HKCR "NSIS.Script\shell\compile\command" "" '"$INSTDIR\makensisw.exe" "%1"'
WriteRegStr HKCR "NSIS.Script\shell\compile-compressor" "" "Compile NSIS Script (Choose Compressor)"
WriteRegStr HKCR "NSIS.Script\shell\compile-compressor\command" "" '"$INSTDIR\makensisw.exe" /ChooseCompressor "%1"'
ReadRegStr $R0 HKCR ".nsh" ""
StrCmp $R0 "NSHFile" 0 +2
DeleteRegKey HKCR "NSHFile"
WriteRegStr HKCR ".nsh" "" "NSIS.Header"
WriteRegStr HKCR "NSIS.Header" "" "NSIS Header File"
WriteRegStr HKCR "NSIS.Header\DefaultIcon" "" "$INSTDIR\makensisw.exe,1"
ReadRegStr $R0 HKCR "NSIS.Header\shell\open\command" ""
StrCmp $R0 "" 0 no_nshopen
WriteRegStr HKCR "NSIS.Header\shell" "" "open"
WriteRegStr HKCR "NSIS.Header\shell\open\command" "" 'notepad.exe "%1"'
no_nshopen:
SectionEnd
Pidgeot
25th April 2004 17:29 UTC
If a user installs NSIS without having administrative rights, it will still install, but associations can't be made. My guess would be that this is the case.
mdlazreg
25th April 2004 21:33 UTC
Thanks for all the reply.
I will answer your question on monday Joost, (the machine at work...).
I think however that Pidgeot's suggestion is right because indeed I do not have admin permissions on the machine that does not register the extension. And I do have admin premissions on my home machine.
If that is the case. Is there anyway to register the extension even for a non admin user installing?
Thanks again.
Pidgeot
26th April 2004 08:31 UTC
AFAIK, you can't have seperate associations for extensions on a per-user basis. Therefore, you'd have to modify the extension for everybody, and that requires administrative rights.
You could ask someone who is an admin to install it, though I doubt that (s)he'll do it. Or you can make a shortcut to Notepad in the folder you keep your scripts, and drag them onto there to edit. Can save a little time compared to using File|Open.
Of course, opening such files in the "traditional" way (through File|Open...) is also a possibility.
mdlazreg
26th April 2004 15:41 UTC
Thanks Pidgeot.
To answer Joost's question:
The .nsi key does exist in the HKEY_CLASSES_ROOT registry hive. But I noticed that the "NSIS.Script" does not!.
Which maybe means that only the first line of :
WriteRegStr HKCR ".nsi" "" "NSIS.Script"
WriteRegStr HKCR "NSIS.Script" "" "NSIS Script File"
is executed while running makensis.nsi
Joost Verburg
26th April 2004 16:04 UTC
Both lines are always executed, it must be a system problem or an another program that has deleted it.
mdlazreg
26th April 2004 22:05 UTC
Hi Joost,
Sorry I mislead you when I said that "The .nsi key does exist in the HKEY_CLASSES_ROOT registry hive" actually I found out that it was added not by the NSIS installer but later on when I manually choose netpad.exe as the default opener of .nsi files, it even created another key "nsi_auto_file". Apprently windows does this automatically...
My conclusion is that only an admin can register an extension because a regular user can not write to the HKCR hive.
My question now, what if I use HKCU in VegetaSan's code above? would it register the extension for at least the current user?
Thanks all.
Joost Verburg
26th April 2004 22:54 UTC
File associations can only be stored in HKCR.
mdlazreg
26th April 2004 23:15 UTC
I found a solution but I am surprised it works :
Function RegFlowizardExt
WriteRegStr HKCU "Software\Classes\.flowizard" "" "flowizardfile"
DetailPrint "Registering .flowizard extenstion"
WriteRegStr HKCU "Software\Classes\flowizardfile\DefaultIcon" "" "$INSTDIR\${FLUENT_INC}\license\flowizard.ico"
WriteRegStr HKCU "Software\Classes\flowizardfile" "" "shell"
WriteRegStr HKCU "Software\Classes\flowizardfile\shell" "" "open"
WriteRegStr HKCU "Software\Classes\flowizardfile\shell\open\command" "" "$INSTDIR\${FLUENT_INC}\bin\ntx86\flowizard.exe"
FunctionEnd
If I call this function and even if I am not admin, it does create File associations even if I am not using HKCR but HKCU instead!
Joost Verburg
26th April 2004 23:23 UTC
You're right. This feature has been introduced in Windows 2000.
http://support.microsoft.com/default...;EN-US;q257592
mdlazreg
27th April 2004 00:30 UTC
Great!
Here is my final solution for anyone to use :
Function RegFlowizardExt
DetailPrint "Registering .flowizard extenstion"
WriteRegStr HKCR "Software\Classes\.flowizard" "" "flowizardfile"
IfErrors UseHKCU UseHKCR
UseHKCU:
WriteRegStr HKCU "Software\Classes\.flowizard" "" "flowizardfile"
WriteRegStr HKCU "Software\Classes\flowizardfile\DefaultIcon" "" "$INSTDIR\${FLUENT_INC}\license\flowizard.ico"
WriteRegStr HKCU "Software\Classes\flowizardfile" "" "shell"
WriteRegStr HKCU "Software\Classes\flowizardfile\shell" "" "open"
WriteRegStr HKCU "Software\Classes\flowizardfile\shell\open\command" "" "$INSTDIR\${FLUENT_INC}\bin\ntx86\flowizard.exe"
UseHKCR:
WriteRegStr HKCR "Software\Classes\flowizardfile\DefaultIcon" "" "$INSTDIR\${FLUENT_INC}\license\flowizard.ico"
WriteRegStr HKCR "Software\Classes\flowizardfile" "" "shell"
WriteRegStr HKCR "Software\Classes\flowizardfile\shell" "" "open"
WriteRegStr HKCR "Software\Classes\flowizardfile\shell\open\command" "" "$INSTDIR\${FLUENT_INC}\bin\ntx86\flowizard.exe"
FunctionEnd
This function can register my extension as a regular user and as admin.
Thanks all:).
eccles
27th April 2004 13:33 UTC
You should add "Goto end" before "UseHKCR:" and then "end:" before "FunctionEnd". :)
mdlazreg
27th April 2004 14:56 UTC
Ah! I did not know that the excution continue to the next label!... Thanks for the fix;).