Read me file with Inno Setup - inno-setup

I am programming my Inno Setup Compiler that I was asking about earlier but had encountered a problem . How do I let the Installer add a Read me File?? I am using Inno Setup Compiler 5.5.3 and uses the following command "AppReadmeFile=C:\Users\Cordre\Desktop\D_C Databasis Tools\Read me.txt" in Inno but if I install the program their is no Read Me file in the Program files.
The text document does exist and is called correctly double checked that.
Is their any other command that I also have to use?

From the documentation on AppReadmeFile:
This string, which may be a URL, is displayed on the "Support" dialog
of the Add/Remove Programs Control Panel applet in Windows 2000/XP and
later. The value may include constants.
This directive has nothing to do with a README file in the Program Files directory. If you want a copy of the README in the Program Files directory, you'd need to add it to the [Files] section. For example:
[Files]
Source: "MyReadme.txt"; DestDir: "{app}"; Flags: ignoreversion
You can also add an icon to the file using the [Icons] section. According to the documentation, a sample Icons entry would be:
Name: "{group}\My Program"; Filename: "{app}\MYPROG.EXE"; WorkingDir: "{app}"

Related

Inno Setup will not create folder under C:\Users\Public - will instead do C:\Users\Public\Public Documents

I am using Inno Setup to build my installer and I have the C:\Users\Public folder hardcoded in my [Files] section to place some files (Inno Setup does not have a constant for this folder)
My goal is to have the install create a C:\Users\Public\MyApp folder with some files in it. However when I run the install, it is creating the folder here:
C:\Users\Public\Public Documents\MyApp
Is this a permissions issue where the installer doesn't have access to create a folder directly under C:\Users\Public?
[Files]
Source: "MyApp\db.mdf"; DestDir: "{drive:{src}}\Users\Public\MyApp"; Flags: ignoreversion;
I cannot reproduce your problem. For me your code works. I've tested it on Windows Vista, 7 and 10. It always installs to C:\Users\Public\MyApp.
Though I do not understand the {drive:{src}}. How does the drive of the Users folder relate to the drive of the installer? You should use the {sd} constant:
[Files]
Source: "MyApp\db.mdf"; DestDir: "{sd}\Users\Public\MyApp"; Flags: ignoreversion
But anyway, to resolve the path to the C:\Users\Public, you can use the PUBLIC environment variable:
[Files]
Source: "MyApp\db.mdf"; DestDir: "{%PUBLIC}\MyApp"; Flags: ignoreversion
It works since Windows Vista.
Alternatively, you can use SHGetKnownFolderPath with FOLDERID_Public. For an example code, see Constant for AppData\LocalLow?
If you need to support even Windows XP, where there is no C:\Users\Public folder or PUBLIC variable, you have to find out, what path your need to use there instead (probably C:\Documents and Settings\All Users), and implement a fallback using a scripted constant:
[Files]
Source: "MyProg.exe"; DestDir: "{code:GetPublicPath}\MyApp"; Flags: ignoreversion
[Code]
function GetPublicPath(Param: string): string;
begin
Result := GetEnv('PUBLIC');
if Result <> '' then
begin
Log(Format('PUBLIC is "%s"', [Result]));
end
else
begin
Result := GetEnv('ALLUSERSPROFILE');
Log(Format('PUBLIC is not set, ALLUSERSPROFILE is "%s"', [Result]));
end;
end;
And for others, it's worth noting that your need for resolve C:\Users\Public is very specific, related to this question: C++ app MDB in ProgramData copies to user's AppData folder when I dont want it to.
One usually does not want the C:\Users\Public, but C:\Users\Public\Documents (= {commondocs}) or C:\ProgramData aka C:\Users\All Users (= {commonappdata}).

Inno Setup: How to dynamically add files to the installation?

Is there a way to dynamically fill the [Dirs] and [Files] sections of an Inno Setup script?
Here is what I am trying to do:
during the install process, the user will select foo (foo matches a repository to get from our SCM)
Setup will run a batch to checkout foo from our SCM
then the content of foo must be added to the [Dirs] and [Files] sections of the script
Everything works fine except for the last step. I searched around and couldn't find explanations on how to do this. I have the feeling that my script should embed all the repositories of our SCM to then be able to copy only the selected ones to the destination directory.
Thanks for your help!
Regards,
See Inno Setup Prompt for external file location.
And add the recursesubdirs flag.
You may also need the createallsubdirs flag (assuming from your reference to the [Dirs] section).
[Files]
Source: "{code:GetScmPath}"; DestDir: "{app}"; \
Flags: external recursesubdirs createallsubdirs
[Code]
function GetScmPath(Param: string): string;
begin
Result := { make it return path to the checked out files }
end;

How to have a checkbox for readmefile at the finished page in InnoSetup

I want to have a checkbox at the finishpage of InnoSetup to open or not the readme file. I try something like this (like it's explain here flag postinstall but it seems doesn't works:
Name: "StartAfterInstall"; Description: Display the PDF Readme File; Languages: english
Filename: "{app}\readme.pdf"; Tasks: StartAfterInstall; Flags: shellexec postinstall runasoriginaluser; Languages: not French
It propose only to launch the program. Is there a way to do this without use the [code] section in Inno Setup or not?
For this task simply mark your readme file entry in your [Files] section with the isreadme flag and let the Inno Setup do the rest for you:
[Files]
Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme
The isreadme flag is described as (emphasized by me):
File is the "README" file. Only one file in an installation can have
this flag. When a file has this flag, the user will asked if he/she
would like to view the README file after the installation has
completed. If Yes is chosen, Setup will open the file, using the
default program for the file type. For this reason, the README file
should always end with an extension like .txt, .wri, or .doc.
Note that if Setup has to restart the user's computer (as a result of
installing a file with the flag restartreplace or if the AlwaysRestart
[Setup] section directive is yes), the user will not be given an
option to view the README file.

Replacing a file whose file name changes every release with Inno Setup

I am creating an installer using Inno Setup and I have a file whose name changes every release (because the file name has the version number embedded in it):
#define MY_FILE_NAME "file_1.0.0.jar"
[Files]
Source: {#MY_FILE_NAME}; DestDir: {app}; Flags: ignoreversion
How would I make my installer remove file_1.0.0.jar from the install location when installing file_2.0.0.jar?
I added an [InstallDelete] section which seems to do the trick:
[InstallDelete]
Type: files; Name: "{app}\file_*.jar"

Inno Setup: pack folder with all subfolders

I have this line in .iss file:
Source: "..\Tcl\*"; DestDir: "{app}\Tcl"; Flags: ignoreversion
which packs folder Tcl. But it takes only files inside folder, but does not take subfolders inside Tcl. Is there a way to take entire folder Tcl with all subfolders and files? (without listing all that subfolders line by line).
Inno Setup 5.4.2.
Yes, there is. Simply include the recursesubdirs flag to your [Files] section entry. The help says about this flag the following:
Instructs the compiler or Setup to also search for the Source
filename/wildcard in subdirectories under the Source directory.
So, all you should do is modify your [Files] section entry this way:
[Files]
Source: "..\Tcl\*"; DestDir: "{app}\Tcl"; Flags: ignoreversion recursesubdirs
You can also use the Inno Wizard, but you'll need to correct the script afterwards if you would like those files to stay in the folder they're imported from, because the Wizard will put them in the app default folder.
The wizard wil generate:
[Files]
Source: "..\Tcl\*"; DestDir: "{app}; Flags: ignoreversion recursesubdirs
If you need to maintain the folder structure you'll need:
[Files]
Source: "..\Tcl\*"; DestDir: "{app}\Tcl"; Flags: ignoreversion recursesubdirs
Inno Wizard Update as of 5.6.1 (08/14/2018)
The Inno Setup Script Wizard now has the option to specify a subfolder. On the Application Files step of the wizard, use the Add Folder... button, then after you select the folder you would like to add, make sure it is selected in the list and then click Edit... and under the Destination Subfolder textbox, specify where you would like the previously selected folder contents to go.

Resources