How can I use NSIS to make an installer that will immediately unpack and run files?

93 Views Asked by At

How can I use NSIS to make such an installer? After launching, the application is immediately unpacked and launched. Is there any nsis script to create something like this? It's not the first time I've seen this style of installer.

example 1:

example 1

example 2:

example 2

example 3:

example 3

I am sure that this is NSIS because inside the exe (if you look through 7zip) there are such files and folders, and such files and folders are inherent only in NSIS.

screenshot 1:

screenshot 1

screenshot 2:

screenshot 2

I tried all the NSIS examples that are in the program folder, I did not find such a script. I couldn't find it on Google either. I also tried using INNO Setup, but realized that those installers that are in the screenshots, they are 100% made through NSIS.

1

There are 1 best solutions below

0
Anders On

You can resize it at run-time:

RequestExecutionLevel Admin
InstallDir "$ProgramFiles\MyApp"
Name "NotAGoodIdea"
XPStyle On
ShowInstDetails NeverShow
InstProgressFlags Smooth
SubCaption 3 " "

Page InstFiles "" InitUIShow

Function InitUIShow
FindWindow $5 "#32770" "" $HWNDPARENT
FindWindow $0 "msctls_progress32" "" $5
System::Call 'USER32::GetWindowRect(pr0,@r1)'
System::Call '*$1(i,i.r2,i,i.r9)'
IntOp $7 $9 - $2
IntOp $7 $7 + 3
IntOp $6 $7 * 3
System::Call 'USER32::GetWindowRect(p$HWNDPARENT,@r1)'
System::Call '*$1(i.r1,i.r2,i.r3,i)'
!define SIZECHANGE 70
IntOp $8 $3 - $1
IntOp $9 $9 - $2
IntOp $9 $9 + ${SIZECHANGE}
System::Call 'USER32::SetWindowPos(p$HWNDPARENT,p0,i0,i0,i$8,i$9,i0x12)'
System::Call 'USER32::GetWindowRect(pr5,@r1)'
System::Call '*$1(i.r1,i.r2,i.r3,i)'
IntOp $8 $3 - $1
System::Call 'USER32::SetWindowPos(p$0,p0,i0,i$6,i$8,i$7,i0x10)'
FunctionEnd

Section
!macro PretendToDoSomething
System::Call 'KERNEL32::GetTickCount()i.r0'
IntOp $0 $0 & 0xff
DetailPrint "Operation $0"
Sleep 1000
!macroend
!insertmacro PretendToDoSomething
!insertmacro PretendToDoSomething
!insertmacro PretendToDoSomething
!insertmacro PretendToDoSomething
!insertmacro PretendToDoSomething
!insertmacro PretendToDoSomething
/*
Replace the above macro with:
SetOutPath $InstDir
File myapp.exe
ExecShell "" "$InstDir\myapp.exe"
*/
Quit
SectionEnd

but the sane way to change the UI is to use Resource Hacker to modify one of the files in ...\NSIS\Contrib\UIs and apply it with ChangeUI/!define MUI_UI myfile.exe.