Creating Zip File in Inno Setup Script - zip

Suppose I want to put a zip file in the installation path after installation. But this zip file is not available to me, so it has to be created in the build process.
And a folder must be added to another folder and the zip file must be created from it.
For example I have:
C:Folder1
C:Folder2
And zip file must be:
C:Folder1/Folder2
With all the files in respective folder.
I have unfortunately very little experience with Inno-Setup and this particular problem with the folder in another folder pack without changing the source path but a zip file in .exe to do I find nowhere.

Inno Setup cannot create a zip file for you while compiling.
But you have two options how to delegate the zip creation to an external process
If you are automating complex build process, you will likely be running Inno Setup command-line iscc compiler. So just before running it in your batch build process, run another process/software/tool to create the zip file.
For some example, see:
Inno Setup Pre- / Post- compile action
If you really want to create the zip file on the fly, while manually building the installer in Inno Setup GUI, you can use preprocessor Exec function to start an process/software/tool to create the zip file before the actual compiling begins.
For some examples, see:
Inno Setup Pre- / Post- compile action
Create files in Inno Setup setup needed by the [Files] section
Is it possible to call a batch file while compiling an Inno Setup script?
As for the actual zip file creation, that's not really Inno Setup question anymore. You will file lot of question about that, for example:
Batch file script to zip files

Related

Inno Setup - Post Processing

I would like to build an MD5 checksum file of the setup file generated by Inno Setup. I've found the pre-processor and was wondering if there is a way to do some processing once the 'setup' output file has been created.
It needs to run at the compile time not during installation.
If you are automating your build, just use command-line compiler from a batch file (or any other script).
And as a next step, run a tool to calculate the checksum.
"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" Example1.iss
certutil -hashFile mysetup.exe MD5
Alternatively, use Inno Script Studio (clone of Inno Setup).
It has [PostCompile] section. In its GUI, it's "Post Compilation Steps".

Path to store Inno Setup output files to (Setup-*.bin)

How to change names, extensions and locations of setup-*.bin (Inno Setup internal compression archive file)
Default archive location: {src}
Location where I want: {src}\Data (Data is a folder.)
There are many way to change the output folder and base file name here are a few:
In inno setup
[Setup]
OutputDir={userdocs}\Data({userdocs}means my document,change this if you want another folder)
To change Output Base File name that is setup-*.bin in your case
[Setup]
OutputBaseFilename=setup(change setup to any name)
To change the size of setup-*.binyou can use
[Setup]
DiskSpanning=true
DiskSliceSize=2000000000(as your preference).
{src} is nothing but a directory constants which mean
"The directory in which the Setup files are located".
PS: If you want to create script for inno setup you can use ISTool instead then use the script in inno setup.
Thanks if you like my answer then accepted it.
By the setup-*.bin, I assume you refer to output files resulting from disk spanning. I do not know what "Inno Setup internal compression archive file" is.
Default location for Inno Setup output files is not {src} (it wouldn't make sense) but subfolder "Output" under the directory containing the script."
You can change this using OutputDir directive.
Quoting Inno Setup documentation:
Specifies the "output" directory for the script, which is where the Setup Compiler will place the resulting SETUP.* files. By default, it creates a directory named "Output" under the directory containing the script for this.

inno setup doesn't decompress each .bin file

I downloaded an iso which contains the files
setup.exe
setup-1.bin
setup-2.bin
It fails to install by executing the setup.exe so I analyzed it with innoextract, which opens just setup-1.bin but not setup-2.bin. Can I manually decompress the .bin files or modify the setup.exe? If yes, how can I do that?
I think the second bin file is just corrupted, so i'm unable to extract it.
That is the reason why Inno Setup cannot continue in installation.
I think this is an answer - you simply need to download the installer again.

How can a zip-file via NSIS be unzipped and the NSIS-scriptfile into folder be executed automatically?

I am writting a NSIS-script for installs of the programs and put into folder. The folder is zipped via NSIS. I want, that someone clicks once the zip-file and it will be unzipped and executed the NSIS-script into folder. But how?
Update: I explain again. NSIS has the compiler for NSIS script and Installer based on ZIP! Firstly, I write a NSIS script to install some programs in a folder. Executing the NSIS script is working! I dont want to send the folder, but I want to send only one file. So I am using the Installer based on ZIP to zip the folder. But if I click the zipped file, it will be unzipped on desktop without executing the NSIS script into folder. So I have to click the NSIS script into folder. That I dont want! I want to click only on zipped file and it will be unzipped and executed automatically the NSIS script. Clearly?
.zip files cannot execute code.
NOTE: The ZIP2EXE NSIS tool uses makensis internally, it is just a helper application that creates simple installers.
Your question is confusing, but I believe that what you want to do is create a self extracting archive that contains multiple files and run and NSIS installer contained in that archive it is unpacked.
You can do this with 7zip.
It's easiest to do this with a dos batch file. Open notepad and create "selfinstall.bat"
Add the following;
(
ECHO ;!#Install#!UTF-8!
ECHO Title="My Installer"
ECHO BeginPrompt="Do you want to run the installer?"
ECHO ExecuteFile="Setup.exe"
ECHO ;!#InstallEnd#!
) > temp.$$$
This sets up the information that the self extracter needs such as it's title (My Installer) and the name of the executable to run (Setup.exe)
Then, add the lines to create your zip file
7z a -r files.7z myfolder
where myfolder is the name of the folder that has all the files.
Now, add the installer - Make sure that the installer (Setup.exe) is in the root of the .7z file
7z a files.7z Setup.exe
Then, copy the self extracter and the 7z to a single executable file
copy /b 7z.sfx + temp.$$$ + files.7z "Install.exe"
Then delete your temp files
del files.7z
del temp.$$$
I adapted this from a script I saw here; http://www.911cd.net/forums//index.php?showtopic=18845
For more information on the .SFX modules see here; http://7zsfx.info/en/
There's also a sourceforge project for a GUI to accomplish this; http://sourceforge.net/projects/sfx-maker/

How to get path where is temporary Inno setup file is located

I have a DLL that I am calling from Inno setup script, dll is looking to load some file from the path where executable is located.
In my case when I execute the setup, temporary executable is exported in temp folder is-xxxxx
BTW, {tmp} is not the right one. It is another tmp folder but not the one that temporary setup.
I need to know that in inno setup is there a constant to represent that folder.
Thanks.
Your DLL can determine which path it's been extracted to and it can also determine the path of the temporary executable. The way you do it depends on the language your DLL is written in.
But the Key Windows API call is GetModuleFileName
If your DLL was written in Delphi you could use the following to get the path of Setup.exe
ExtractFilePath(ParamStr(0))
How about this
path := ExpandConstant('{src}');

Resources