Archive: Running a hidden app on finish


Running a hidden app on finish
I have a hidden app that does nothing more than call DOSBox with the "-conf" parameter. This launcher works fine when executing on its own but will not even start when called from the run of the MUI2 finish page. Its process never shows in the task manager. It also works from the run of the finish page with no changes to the script if I compile the launcher to run unhidden.

Obviously, there are a number of workarounds, but I would like to know how to use a hidden for the finish run or at least why it does not work.


If you want to run an application with arguments, you must define like this:
!define MUI_FINISHPAGE_RUN "$INSTDIR\YourApp.exe"
!define MUI_FINISHPAGE_RUN_PARAMETERS "-conf"
But not:
!define MUI_FINISHPAGE_RUN "$INSTDIR\YourApp.exe -conf"

If the process is always running, maybe it is a service. You may try the Services, SimpleSC or NsSCM plugin.


No, the NSIS script is right. I have been writing NSIS installers for years now. The parameter is passed by the EXE to be run after the installer finishes, and not from the NSIS script. It is the EXE itself that is set to run hidden, not by NSIS. As I said, If I recompile the application (not the installer) to run not hidden it works. If I compile it to run as a hidden EXE, the process does not even start. It does work independent of the installer as well as from OnInstSuccess.

The question remains, why does the exe executed by the finish page run start if it compiled to run not hidden, but does not start when compiled to run hidden. As I had first posted, there are a number workarounds that will do what I want, but I just want to know why a hidden app will not start from the finish page run.


Run it in a Section, use IfSilent to determine wether to install.
Section -Hidden
IfSilent 0 +2
Exec '"$PATH\YouApp.exe" -args'
SectionEnd
Define a function to replace running default application.
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "Run ApplicationName"
!define MUI_FINISHPAGE_RUN_FUNCTION FuncName
Function FuncName
IfSilent +2
Exec '"$PATH\YouApp.exe" -args'
FunctionEnd
Now you installer would run it on both mormal and silent mode.


Your explanation is making it sound too mysterious. NSIS doesn't know if you compiled your program to appear or remain hidden, so why (how) would it do something different for the two versions of the program? The finish page Run functions work fine for the programs I run that don't have a UI. There must be something failing in the hidden version of your program.


oO

if you run your installer silent you have no Finish-page. So you can´t execute something on finishpage in silent mode because it doesn´t appear.

So as jiake wrote you have to modify your script. For GUI install you can leave the execution on the finishpage. But for silent mode you have to put it in a section or in .OnInstSuccess with "IfSilent".


There is nothing hidden in the installer and it is not set to run silent. The only thing that is hidden is completely independent of NSIS. It is a file that gets installed by the installer that has been compiled completely separate from NSIS to run silent.

As I said, if that file is compiled to run not hidden the NSIS/MUI2 run on finish works. When it compiled to run hidden the NSIS/MUI2 run on finish does not work with no changes to the NSIS script. The process never starts. Additionally, the file works as expected outside of the installer.