Clarification about using RunOnceId in [UninstallRun] section of Inno Setup script - inno-setup

Here is my [UninstallRun] section:
[UninstallRun]
Filename: {dotnet40}\regasm.exe; Parameters: /u MSAToolsLibrary_x86.dll; WorkingDir: {app}; Flags: runhidden;
Filename: {dotnet4064}\regasm.exe; Parameters: /u MSAToolsLibrary_x64.dll; WorkingDir: {app}; Flags: runhidden; Check: IsWin64;
Filename: {dotnet40}\regasm.exe; Parameters: /u MSAToolsGMailLibrary_86.dll; WorkingDir: {app}\MSAToolsGMailLibrary; Flags: runhidden
Filename: {dotnet4064}\regasm.exe; Parameters: /u MSAToolsGMailLibrary_64.dll; WorkingDir: {app}\MSAToolsGMailLibrary; Flags: runhidden; Check: IsWin64;
When I compile with Inno Setup 6.1.1 I get this warning:
Warning: There are [UninstallRun] section entries without a RunOnceId parameter. By assigning a string to RunOnceId, you can ensure that a particular [UninstallRun] entry will only be executed once during uninstallation. See the "[UninstallRun]" topic in help file for more information.
I have looked up the help for RunOnceId where it states:
Valid only in an [UninstallRun] section. If the same application is installed more than once, "run" entries will be duplicated in the uninstall log file. By assigning a string to RunOnceId, you can ensure that a particular [UninstallRun] entry will only be executed once during uninstallation. For example, if two or more "run" entries in the uninstall log have a RunOnceId setting of "DelService", only the latest entry with a RunOnceId setting of "DelService" will be executed; the rest will be ignored. Note that RunOnceId comparisons are case-sensitive. If you don't assign a string to RunOnceId, the compiler will warn you about this, which can be disabled using MissingRunOnceIdsWarning.
I can see that I can switch off the warning. But I wanted to know if I really needed to use this parameter in my setup because I never have done so until now.

You should use the parameter, as the warning suggests.
If you don't, for every upgrade (unless your installer uninstalls the previous version), a new execution of your [UninstallRun] commands will be queued. So if you install and then upgrade 9 times, all your uninstall commands will be executed 10 times, when uninstalling. Of course, in your case, that only means each your regasm /u command will fail 9 times. Not a big deal, but if user inspects an uninstaller log (in case they have problems), they will see lot of failures, what may mislead them.
Note that you cannot fix this retrospectively. The uninstall commands queued by previous installers will still be executed for each past installation. But again, were it a major problem, you would probably have noticed already.

Related

How to open a INI file with Notepad.exe in [Run] section?

In Inno Setup, how can i open an INI file with Notepad.exe using the [Run] section?
This is what i have, but its getting "%1 is not a valid win32 program"...
[Run]
Filename: "{app}\data.ini"; Description: "Check here see data."; Flags: postinstall runascurrentuser skipifsilent unchecked;
What i need is to open that file in user notepad after finishing the installation, if the user checked that checkbox.
Maybe its easier to do with code, but i am not sure how to do it.
Thanks.
Try this:
Filename: "notepad"; Parameters: {app}\data.ini; Description: "Check here see data."; Flags: postinstall runascurrentuser skipifsilent unchecked;

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.

Read me file with 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}"

Inno Setup : How to set installer "Run As Administrator"?

In Inno Setup,
[Setup]
PrivilegesRequired=admin
is still can not Run the installer as Administrator, but I need to Launch my Program at last step of Inno Setup.
How can I do to set my Installer can Run as Administrator ?
I have been having this same problem as well, it took me quite a bit of time to figure out that after you have set the PrivilegesRequired=admin you also need to add runascurrentuser to all the Flags under [Run] section.
[Setup]
PrivilegesRequired=admin
[Run]
Filename: "{app}\MyApp.exe"; Description: "{cm:LaunchProgram,MyApp}"; Flags: runascurrentuser nowait postinstall skipifsilent; Check: returnTrue()
Filename: "{app}\MyApp.exe"; Flags: runascurrentuser; Parameters: "-install -svcName ""MyApp"" -svcDesc ""MyApp"" -mainExe ""MyApp.exe"" "; Check: returnFalse()
I know you have probably already figured out the issue considering this question was asked over two years ago but I thought I would answer it anyway for others like myself who found this unanswered question but would have really liked to have seen an answer.
My inno setup script is belowing,
#define MyAppName "MyApp"
#define MyAppExeName "MyApp.exe"
[Setup]
PrivilegesRequired=admin
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: runascurrentuser nowait postinstall skipifsilent

Resources