Skip to content
⌘ NSIS Forum Archive

Loading Bar and Execwait question?

7 posts

joseph0953#

Loading Bar and Execwait question?

I put “ Execwait “ command in install section, but when the files extract finish and execute program, loading bar can not auto close, so it will be appear two windows together.Is there a way to let loading bar display the files extract finish and auto close itself then run the program?
Red Wine#
Well, ExecWait means execute the specified process and wait until finishes, thus is useful if you want during the installation to execute a process and continue.
Probably you should replace it with Exec and add it in function .onInstSuccess instead of section.
joseph0953#
Thanks help

Thanks Red Wine, Thanks for your help

But I still have another question ,How do I know use which command when program close then the files can be delete in function .onInstSuccess.
Red Wine#
Well, one option is to add the command Delete /REBOOTOK right after the Exec command, e.g.
Exec "$TEMP\my_file.exe"
Sleep 100
Delete /REBOOTOK "$TEMP\my_file.exe"
Another option, hide installer window and use ExecWait, e.g.
HideWindow
ExecWait "$TEMP\my_file.exe"
Delete "$TEMP\my_file.exe"
joseph0953#
The program can not run ...

OutFile "App.exe"
Caption "Loading..."
Section
DetailPrint 'Initializing...'
Sleep 500
Sleep 500
DetailPrint 'Loading Graphics...'
Sleep 500
Sleep 500
DetailPrint 'Finalizing...'
Sleep 500
Sleep 500
SetDetailsPrint None

SetOutPath $Temp\ABC
File "AAA.dll"
File "BBB.dat"
File " App.exe "

SectionEnd

Subcaption 3 " "
XPStyle on
AutoCloseWindow true
ChangeUI all "${NSISDIR}\Contrib\UIs\LoadingBar.exe"

Function .onInstSuccess

Exec "$INSTDIR\ App.exe "

FunctionEnd

My question is when user close the program then how can let these files will be delete automatically. If put delete command in Function .onInstSuccess ,the program can not run
Red Wine#
You're extracting these 3 files in $TEMP and then you execute a file from $INSTDIR, is this correct? Anyway, probably you don't need the callback at all.
Extract the files in $PLUGINSDIR and add a last hidden section where you should hide installer (HideWindow) and ExecWait "$PLUGINSDIR\App.exe"
That's all