Skip to content
⌘ NSIS Forum Archive

GetParameters in the uninstaller

5 posts

coco_vc#

GetParameters in the uninstaller

Hi all,

I need to have some parameters in the installer and uninstaller. For this I'm using the following code:


!include "FileFunc.nsh"
!insertmacro GetParameters
!insertmacro GetOptions
...
Var cmd_line
...
${GetParameters} $cmd_line
${GetOptions} $cmd_line "${MY_PARAM}" $0
IfErrors 0 found_my_param
...
which works fine as long as the GetParameters call is in a section from installing. When I move the last part into the uninstall secction I get: "Call must be used with function names starting with "un." in the uninstall section". I know that, but I don't know how to change it.
I tried:

!include "FileFunc.nsh"
!insertmacro un.GetParameters
...
Var cmd_line
...
${un.GetParameters} $cmd_line
...
but I get: "Error in macro un.GetParametersCall on macroline 4"

So, can pls smbd change the code I posted at the beginning of this entry so that it can be places in the uninstall section?

Thx,
Viv
coco_vc#
Variable cmd_line was not declared at all, this is why it was not working. Now I added it (doesn't need to be before the insertion of the un.GetParameters) and it works!

Thx a lot galil,
Viv
Guest#
Hello,
This seems to be ok for the GetParameters function. But if I want to use a macro like WordFunc, which takes parameters, there is no way to call this from the uninstaller - as I get the same error "Call must be used with function names starting with "un." in the uninstall section." Changing the macro name to un.${WordFind} or ${un.WordFind} does not work.
Is there any equivalent of the GetParameters solution here, say a WordFunc function (but then again it won't take parameters right).

Sorry if I'm missing something obvious here 🙂 but I've searched the forums, with no result.

Regards
Hrishikesh
Guest#
Ok I figured it out myself by reading the NSIS\Include\WordFunc.nsh header.

------------
Declare the macro at the top as
!insertmacro un.WordFind

and then use it as

${un.WordFind} $params " " "+1" $R0

----------------
I was missing the insertmacro part - had declared the installer version 🙂

Regards
Hrishikesh