Skip to content
⌘ NSIS Forum Archive

Run application compulsorily after install

9 posts

winman2004#

Run application compulsorily after install

In my setup i have finish page done by using !insertmacro MUI_PAGE_FINISH . I have also used !define MUI_FINISHPAGE_RUN "$INSTDIR\setup.exe" which run the application if the user selects the checkbox in finish page. I think it is the default behaviour of finish page. But i want the application to run compulsorily after install if a certain command line is passed.otherwise it should work normal as before. So how it can be done?
aerDNA#
!define MUI_PAGE_CUSTOMFUNCTION_SHOW FinishPage_Show
!insertmacro MUI_PAGE_FINISH

Function FinishPage_Show
StrCmp $Something "Something" 0 +2
ShowWindow $mui.FinishPage.Run ${SW_HIDE}
FunctionEnd

If you use MUI_FINISHPAGE_RUN_NOTCHECKED, you also need:
SendMessage $mui.FinishPage.Run ${BM_SETCHECK} ${BST_CHECKED} ""
winman2004#
Originally Posted by aerDNA View Post
!define MUI_PAGE_CUSTOMFUNCTION_SHOW FinishPage_Show
!insertmacro MUI_PAGE_FINISH

Function FinishPage_Show
StrCmp $Something "Something" 0 +2
ShowWindow $mui.FinishPage.Run ${SW_HIDE}
FunctionEnd

If you use MUI_FINISHPAGE_RUN_NOTCHECKED, you also need:
SendMessage $mui.FinishPage.Run ${BM_SETCHECK} ${BST_CHECKED} ""
I included ShowWindow $mui.FinishPage.Run ${SW_HIDE} in FinishPage_Show show function but it didnt work. It is working as before. what else i need to change?

I need the checkbox to be ticked and user cannot change it if a particular command line was passed.
aerDNA#
If it didn't work, it probably means you are using MUI1 (MUI.nsh). In that case, there's no $mui.FinishPage.Run (a MUI2 var), you need to get the checkbox hwnd yourself:
ReadINIStr $0 "$PLUGINSDIR\ioSpecial.ini" "Field 4" "HWND"
The rest is the same. If you don't want the checkbox hidden, just disabled, use: EnableWindow $0 0
winman2004#
i can use ShowWindow and hidden that checkbox? Does it cause any problem?

Also what is Field 4 in ioSpecial.ini? i checked my ini and there was no Fielid 4 . But your solution works perfectly.
winman2004#
Originally Posted by aerDNA View Post
It doesn't cause any problems.
Ok. But can u tell me what is that Field 4?
aerDNA#
MUI1 uses InstallOptions for the Welcome/Finish page and ioSpecial.ini is where the page elements are defined. You couldn't see Field 4 (the Run checkbox) probably because you were looking too early; take a look once the Finish page is displayed.