Old 1st September 2008, 11:10   #1
Jennifer K
Junior Member
 
Join Date: Sep 2008
Posts: 4
HideWindow Doesn't work!

I wrote an installer based on the makensis.nsi example.

Function PageLeaveReinstall was copied verbatim, unmodified (except for the registry path for "UninstallString").

But HideWindow inside that function doesn't work!

PHP Code:
Function PageLeaveReinstall

  
${NSD_GetState$R2 $R1

  StrCmp $R0 
"1" +2
    StrCmp $R1 
"1" reinst_uninstall reinst_done

  StrCmp $R0 
"2" +3
    StrCmp $R1 
"1" reinst_done reinst_uninstall

  reinst_uninstall
:
  
ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NSIS" "UninstallString"

  
;Run uninstaller
  HideWindow

    ClearErrors
    ExecWait 
'$R1 _?=$INSTDIR'

    
IfErrors no_remove_uninstaller
    IfFileExists 
"$INSTDIR\makensis.exe" no_remove_uninstaller

      Delete $R1
      RMDir $INSTDIR

    no_remove_uninstaller
:

  
StrCmp $R0 "2" +2
    Quit

  BringToFront

  reinst_done
:

FunctionEnd 
When I click the "Uninstall before installing" radio button, the uninstaller wizard comes up but if I drag it, the installer wizard becomes visible and I can click it and even see how it completes installation before the poor uninstaller even has a chance to start.

Is this a known bug in nsis?

Tx,
Jen
Jennifer K is offline   Reply With Quote
Old 1st September 2008, 15:35   #2
Jennifer K
Junior Member
 
Join Date: Sep 2008
Posts: 4
Unhappy I think I solved the problem?

First let me correct a mistake in my listing above. Instead of
PHP Code:
ExecWait '$R1 _?=$INSTDIR' 
I actually wrote
PHP Code:
ExecWait '$R1' 
and that was the problem.

As soon as I fixed my code to be exactly what was in makensis.nsi:
PHP Code:
ExecWait '$R1 _?=$INSTDIR' 
It started behaving as I wanted: Install doesn't start running before Uninstall is complete.

This is weird. I don't understand this _? thing: I read the entire 4.9.1.4 ExecWait documentation and didn't find any hint as to what it does.

What does _? do?

Tx,
Jen
Jennifer K is offline   Reply With Quote
Old 1st September 2008, 20:11   #3
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
It's all in help file:
Quote:
_?= sets $INSTDIR. It also stops the uninstaller from copying itself to the temporary directory and running from there. It can be used along with ExecWait to wait for the uninstaller to finish. It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces.
Comperio is offline   Reply With Quote
Old 1st September 2008, 20:39   #4
Jennifer K
Junior Member
 
Join Date: Sep 2008
Posts: 4
Thanks! I did search the NSIS User Manual but couldn't find any mention of it. Apparently the CHM search and index capabilities are not that great.

Now, the help file says that _?= sets $INSTDIR. This is understandable in a statement like
PHP Code:
ExecWait '$R1 _?=$INSTDIR' 
But what happens if I write
PHP Code:
ExecWait '$R1 _?=$MYBELOVEDVARIABLE' 
Will it also set $INSTDIR or will it set $MYBELOVEDVARIABLE?

Also, where does the weird syntax '_?=' come from?
Is it an assignment to special variable named '_?' ?
Or is it simply an atomic construct to be used as is?

Tx,
Jen
Jennifer K is offline   Reply With Quote
Old 5th September 2008, 10:50   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
The second will not set $MYBELOVEDVARIABLE. Think about it, the executed installer will not even know the command line came from $MYBELOVEDVARIABLE as it will be replaced with its content.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik 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