Archive: MGSBOX async, ExecDos::exec running after installer closes and registry comparison.


MGSBOX async, ExecDos::exec running after installer closes and registry comparison.
  Hi NSIS experts,

I'm playing with NSIS installer during the last 2 weeks and it's awesome, congratulations! :)

I have 3 questions and I can't find the answer myself, neither reading google and documentation, so I'm asking your help.

My installer is an application that will be deployed silent to our workstations of our company via Windows Netlogon.

1) My installer is silent as I told, however, I want to give a brief message to our users that the installation is running just to make them aware. I'm using MSGBOX, and it works, the problem is that I noted that if the user do not click on the "OK" button it never continue the installation and it's a problem, in special because I'm sure that I few users will be switching between applications and this MSGBOX will be minimized and they will not see it and at the end of the day they will turn off the computer and the installation will not be properly completed. There is a way to do a MSGBOX asynchronous ? Or another alternative?

2) At the end of my installer I want to delete all temporary files, including my all installer (because I have confidential data inside), I created a .bat file to delete everything and it works fine when I call from cmd.exe, but not from NSIS installer. I'm using ExecDOS::exec and I tried with /ASYNC and NOUNLOAD, but both fails, I mean, they work, but they are not able to delete my installer because it's in-use. There is a way to execute a command (bat file) in silent mode and exit from the installer but keep the bat file working? Or any other alternative solution to accomplish this goal?

3) I need to do a registry comparison, if value equal x86 I have to execute command A, B and C, if equal to x64 I have to execute command D, E and F and at the end independent of this registry values I have to execute command G and H. I have the following code:

ReadRegStr $1 HKLM "Software\Microsoft\Office\14.0\Outlook" "Bitness"
StrCmp $1 "x86" 86Machine
Goto Independent

ReadRegStr $3 HKLM "Software\Microsoft\Office\14.0\Outlook" "Bitness"
StrCmp $3 "x64" 64Machine
Goto Independent

86Machine:
Command A
Command B
Command C

64Mchine:
Command D
Command E
Command F

Independent:
Command G
Command H
However it always execute all routines (86Machine, 64Machine and Independent). Can you please help me to fix it?

Thanks.

1) Asynchronous MSG is wrong idea, MessageBoxes are used for controlling flow of program, ofter they are used for user decision.
a) simply do not show this MSG
b) create modeless window which will inform user that installer is running - but when installer finishes window will be closed.

2) Create another (silent) installer - called setup2.exe
In your setup.exe call [at the end] setup2.exe which will simply wait several seconds {while setup.exe exits} and then setup2.exe will delete setup.exe and any other files.

3) Flow of your code is wrong, use another GoTo after executing commands for each platform.

ReadRegStr$1 HKLM "Software\Microsoft\Office\14.0\Outlook" "Bitness"

>StrCmp $1 "x86" 86Machine
Goto Independent

ReadRegStr$3 HKLM "Software\Microsoft\Office\14.0\Outlook" "Bitness"
>StrCmp $3 "x64" 64Machine
Goto Independent

86Machine:
>Command A
Command B
Command C
GoTo ContinueAll; Without this jump you will fall into 64Mchine and execute Command D ...

>64Mchine:
>Command D
Command E
Command F
GoTo ContinueAll; Without this jump you will fall into Independent and execute Command G ...

>Independent:
>Command G
Command H

ContinueAll:
;You are here now...