Skip to content
⌘ NSIS Forum Archive

Problem with registerExtension.nsh

9 posts

abu_abdulla#

Problem with registerExtension.nsh

Hi,

I have small problem with registerExtension.nsh
http://nsis.sourceforge.net/File_Association

I use:
${registerExtension} "$INSTDIR\installer.exe" ".mcr" "MCR File"
${unregisterExtension} ".mcr" "MCR File"

it gives me this error when compiling:

Section: "Uninstall"
!insertmacro: unregisterExtension
Push: .mcr
Push expects 1 parameters, got 2.
Usage: Push string
Error in macro unregisterExtension on macroline 2
Error in script "E:\Installer.nsi" on line 250 -- aborting creation process
kichik#
It has a problem with quoting spaces, among other things. It also corrupts some variables. That script needs some work.

I've fixed your specific problem in the Wiki. Try it now.
abu_abdulla#
Appreciate your help.

I have now this exception:
!insertmacro: unregisterExtension
Push: .mcr
Push: MCR File
Call must be used with function names starting with "un." in the uninstall section.
Usage: Call function_name | [:label_name]
Error in macro unregisterExtension on macroline 3
Error in script "E:\Installer.nsi" on line 280 -- aborting creation process


I tried calling:
${unregisterExtension} ".mcr" "MCR File"

from "Uninstall" section and un.onInit function.

Did I missed anything?

Thanks again
kichik#
Another problem with the script. It defines unregsiterExtension as an installer function instead of an uninstaller function.

I've fixed that now as well. Try again.
abu_abdulla#
Thanks it works fine now.

I just have small comment. It seems that reboot is required to refresh the icon of the file. I couldn't find a way to rebuild IconCache.db directly.

In Windows XP

- Go to C:\Documents and Settings\{username}\Local Settings\Application Data
- Delete IconCache.db
- Reboot

In Windows 9x

- Goto c:\windows
- Delete ShellIconCache
- Reboot.
abu_abdulla#
I have another question. Is there a way to let clicking multiple files (at once) goes as parameters to one EXE instance instead of passing each file to one instance of the EXE file i.e.

program.exe <File1 Path>
program.exe <File2 Path>
program.exe <File3 Path>

And I need it to be:

program.exe <File1 Path> <File2 Path> <File3 Path>

Thanks