Spawned uninstaller instance
Hello.
I need to insert MUI_UNPAGE_CONFIRM and disable a message in my uninstaller while running it from the installer. To detect if the uninstaller was spawned, I made-up a commandline switch "/U".
ExecWait "$UNINSTSTR /U _?=$UNINST\\bin"
Is there an easier way?The problem is inserting the confirm unpage macro inside a function that causes a compile-time error: command PageEx not valid in a Function.
; Un-Confirm pageBy way of explaining how I arrived at this point, I have two functions in the uninstaller that test for the /U switch.
>Function un.confirm
StrCmp $SPAWN"1" done
!insertmacro MUI_UNPAGE_CONFIRM
done:
>FunctionEnd
>
PS: Potentially, you could hard-code the switch and query with 'IfSpawned', similar to 'IfSilent' ... just an idea.Variables
.spawn
>Var SPAWN
>; Search in a string from right to left
>; Usage:
; Push "this is a long ass string"
>; Push "ass"
>; Call (un.)StrStrRight
>; Pop $R0
>; ($R0 at this point is "ass string")
Functionun.StrStrRight
Exch $R1; st=haystack,old$R1, $R1=needle
Exch ; st=old$R1,haystack
Exch $R2; st=old$R1,old$R2, $R2=haystack
Push $R3
Push $R4
Push $R5
StrLen $R3 $R1
StrLen $R4 $R2
IntOp $R4 $R4- 1
loop:
StrCpy $R5 $R2 $R3 $R4
StrCmp $R5 $R1 done
StrCmp $R5"" done
IntOp $R4 $R4- 1
Goto loop
done:
IntOp $R4 $R4 + 1
StrCpy $R1 $R2"" $R4
Pop $R5
Pop $R4
Pop $R3
Pop $R2
Exch $R1
FunctionEnd
>; Return length from end of string
>; Usage:
; user variable "SPAWN" equals characters to end of string
>; where "/U" is the last commandline parameter, the output contains 1
>Function un.spawn
Push $CMDLINE
Push "/U"
Call un.StrStrRight
Pop $R0
StrLen $SPAWN $R0
FunctionEnd
>Function un.onInit
Call un
>...
>FunctionEnd
>
edit:
Almost forgot. "Normally" you skip pages with an Abort call in a custom function. Normally. Aborting unpage confirm, aborts the uninstaller.
Confirm page
>!define MUI_PAGE_CUSTOMFUNCTION_PRE un.confirm
>!insertmacro MUI_UNPAGE_CONFIRM
>Function un.confirm
StrCmp $SPAWN"1" done
Abort
done:
>FunctionEnd
>
Why?