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

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;

Related

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

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.

How to override a third-party installation directory with inno setup

I need to install a thirdparty software embedded in a installer named thirdparty-installer.exe and also install my application Instruct.exe. My application will be at c:\MyAPP folder and all my thirdparty files must be at c:\windows\system32 (all files will be thrown there, in the system32 root). I have done the following:
#define OutputDirectory_MPP "c:\myAPP"
[setup]
DefaultDirName=c:\MyAPP
DisableDirPage=yes
[dirs]
Name: {#OutputDirectory_MPP}; Attribs: system
[files]
Source: "g:\application\Instruct.exe"; DestDir: {#OutputDirectory_MPP}
Source: "g:\applicationr\thirdparty-installer.exe"; DestDir: "{cf}"; Flags: ignoreversion recursesubdirs createallsubdirs promptifolder; Permissions: system-full;
[Run]
Filename: "{cf}\thirdparty-installer.exe"; Flags: shellexec waituntilterminated
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
(...)
My Instruct.exe installs normally, and when it finishes, the thirdparty-installer prompts and show the user the option to change installation directory. Their default is c:\program files\Thirdparty2020\
How can I impose their installation to be on the c:\windows\system32 folder and leave no option to the user? (possibly even coupled with a silent install).

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