How to make empty lines in the created INI file during installation in Inno Setup? - inno-setup

The fact is that the text I have goes one after the other:
[Nancy Data]
CDDrive1=C:
CDDrive2=C:
HDDrive=C:
IDPath=\Program Files (x86)\My Program\Нэнси Дрю. Секреты могут убивать
CifTreePath=\Program Files (x86)\My Program\Нэнси Дрю. Секреты могут убивать\ciftree\
HDVideoPath=\Program Files (x86)\My Program\Нэнси Дрю. Секреты могут убивать\HDVideo\
CDVideoPath=\Program Files (x86)\My Program\Нэнси Дрю. Секреты могут убивать\CDVideo\
HDSoundPath=\Program Files (x86)\My Program\Нэнси Дрю. Секреты могут убивать\HDSound\
CDSoundPath=\Program Files (x86)\My Program\Нэнси Дрю. Секреты могут убивать\CDSound\
LoadSavePath=\Program Files (x86)\My Program\Нэнси Дрю. Секреты могут убивать\Save\
RunEntirelyFromCDDrive=0 ; 1=run all app from cdrom, 0=run normal
CifTreeAndFilesOnCD=0 ; 1=all cif/tree files on CDROM, 0=tree on hard drive
TestingModeEnabled=0 ; 1=enable test-only mode, 0=not enabled
ExternalCifFileChecking=1 ; 1=look for cif files external to tree, 0=don't look
DebugOutput=1 ; 1=enable debug output (huge), 0=not enabled
RunInWindowedMode=0 ; 1=run in a window, 0=run full-screen exclusive mode
MaxXAxisTravelPerMove=195 ; max x travel per render loop
MaxYAxisTravelPerMove=150 ; max y travel per render loop
SoundSystemIsActive=1 ; 1=sound, 0=no sound
ForceSoundBufSize=0 ; 0=use default, 1=force size
SoundBufSize=4096 ; size used if forced
SoundBufSkip=6 ; raise if sound skips, lower if video not synching
UseDirectSound=1 ; 0=MME, 1=DirectSound
ClosedCaptioning=1
PlayerSpeech=1
CharacterSpeech=1
VoiceMasterVolume=54
MusicMasterVolume=54
SpecialEffectsMasterVolume=51
SwapLeftAndRightSoundChannels=0
PrimaryVideoNonSoundTimeDelay=300
PrimaryVideoNonSoundFrameTime=66
SystemQualityForPrimaryVideo=0
InstallationType=0
PlayerWonTheGame=StillWorkingOnIt
; 640x480 aspect=1.33 : 1
And I need to format the INI file by inserting empty lines between key groups:
[Nancy Data]
CDDrive1=E:\
CDDrive2=E:\
HDDrive=E:
IDPath=\games\Нэнси Дрю. Секреты могут убивать
CifTreePath=\games\Нэнси Дрю. Секреты могут убивать\ciftree\
HDVideoPath=\games\Нэнси Дрю. Секреты могут убивать\HDVideo\
CDVideoPath=\games\Нэнси Дрю. Секреты могут убивать\CDVideo\
HDSoundPath=\games\Нэнси Дрю. Секреты могут убивать\HDSound\
CDSoundPath=\games\Нэнси Дрю. Секреты могут убивать\CDSound\
LoadSavePath=\games\Нэнси Дрю. Секреты могут убивать\Save\
RunEntirelyFromCDDrive=0 ; 1=run all app from cdrom, 0=run normal
CifTreeAndFilesOnCD=0 ; 1=all cif/tree files on CDROM, 0=tree on hard drive
TestingModeEnabled=0 ; 1=enable test-only mode, 0=not enabled
ExternalCifFileChecking=1 ; 1=look for cif files external to tree, 0=don't look
DebugOutput=1 ; 1=enable debug output (huge), 0=not enabled
RunInWindowedMode=0 ; 1=run in a window, 0=run full-screen exclusive mode
; 640x480 aspect=1.33 : 1
MaxXAxisTravelPerMove=195 ; max x travel per render loop
MaxYAxisTravelPerMove=150 ; max y travel per render loop
SoundSystemIsActive=1 ; 1=sound, 0=no sound
ForceSoundBufSize=0 ; 0=use default, 1=force size
SoundBufSize=4096 ; size used if forced
SoundBufSkip=6 ; raise if sound skips, lower if video not synching
UseDirectSound=1 ; 0=MME, 1=DirectSound
ClosedCaptioning=1
PlayerSpeech=1
CharacterSpeech=1
VoiceMasterVolume=54
MusicMasterVolume=54
SpecialEffectsMasterVolume=51
SwapLeftAndRightSoundChannels=0
PrimaryVideoNonSoundTimeDelay=300
PrimaryVideoNonSoundFrameTime=66
SystemQualityForPrimaryVideo=0
InstallationType=0
PlayerWonTheGame=StillWorkingOnIt
I am creating an INI file using the INI section:
[INI]
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "CDDrive1"; String: "{drive:{src}}"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "CDDrive2"; String: "{drive:{src}}"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "HDDrive"; String: "{drive:{src}}"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "IDPath"; \
String: "{code:RemoveDrive|{app}\Нэнси Дрю. Секреты могут убивать}"; \
Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "CifTreePath"; \
String: "{code:RemoveDrive|{app}\Нэнси Дрю. Секреты могут убивать\ciftree\}"; \
Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "HDVideoPath"; \
String: "{code:RemoveDrive|{app}\Нэнси Дрю. Секреты могут убивать\HDVideo\}"; \
Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "CDVideoPath"; \
String: "{code:RemoveDrive|{app}\Нэнси Дрю. Секреты могут убивать\CDVideo\}"; \
Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "HDSoundPath"; \
String: "{code:RemoveDrive|{app}\Нэнси Дрю. Секреты могут убивать\HDSound\}"; \
Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "CDSoundPath"; \
String: "{code:RemoveDrive|{app}\Нэнси Дрю. Секреты могут убивать\CDSound\}"; \
Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "LoadSavePath"; \
String: "{code:RemoveDrive|{app}\Нэнси Дрю. Секреты могут убивать\Save\}"; \
Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "RunEntirelyFromCDDrive"; String: "0 ; 1=run all app from cdrom, 0=run normal"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "CifTreeAndFilesOnCD"; String: "0 ; 1=all cif/tree files on CDROM, 0=tree on hard drive"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "TestingModeEnabled"; String: "0 ; 1=enable test-only mode, 0=not enabled"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "ExternalCifFileChecking"; String: "1 ; 1=look for cif files external to tree, 0=don't look"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "DebugOutput"; String: "1 ; 1=enable debug output (huge), 0=not enabled"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "RunInWindowedMode"; String: "0 ; 1=run in a window, 0=run full-screen exclusive mode"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "; 640x480 aspect"; String: "1.33 : 1"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "MaxXAxisTravelPerMove"; String: "195 ; max x travel per render loop"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "MaxYAxisTravelPerMove"; String: "150 ; max y travel per render loop"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "SoundSystemIsActive"; String: "1 ; 1=sound, 0=no sound"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "ForceSoundBufSize"; String: "0 ; 0=use default, 1=force size"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "SoundBufSize"; String: "4096 ; size used if forced"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "SoundBufSkip"; String: "6 ; raise if sound skips, lower if video not synching"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "UseDirectSound"; String: "1 ; 0=MME, 1=DirectSound"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "ClosedCaptioning"; String: "1"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "PlayerSpeech"; String: "1"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "CharacterSpeech"; String: "1"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "VoiceMasterVolume"; String: "54"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "MusicMasterVolume"; String: "54"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "SpecialEffectsMasterVolume"; String: "51"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "SwapLeftAndRightSoundChannels"; String: "0"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "PrimaryVideoNonSoundTimeDelay"; String: "300"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "PrimaryVideoNonSoundFrameTime"; String: "66"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "SystemQualityForPrimaryVideo"; String: "0"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "InstallationType"; String: "0"; Flags: createkeyifdoesntexist
Filename: "{app}\game.ini"; Section: "Nancy Data"; Key: "PlayerWonTheGame"; String: "StillWorkingOnIt"; Flags: createkeyifdoesntexist
I found the Format function with this example:
var
S: String;
I: Integer;
begin
S := Format('%d files found', [10]);
// S = '10 files found'
S := Format('Filename: %s', ['file.txt']);
// S = 'Filename: file.txt'
I := 64;
S := Format('%d in hex, padded to 8 digits: %.8x', [I, I]);
// S = '64 in hex, padded to 8 digits: 00000040'
end;
But I didn't understand how I could use it.

While you didn't even told us, I assume that you use [INI] section to create your INI file. As empty lines have no meaning in INI file, neither does Windows INI file API have any means to add empty lines (and consequently neither does Inno Setup API, which is build on top of Windows API).
If you want to make custom modifications to the INI file, you have to treat it as an unstructured text file, not as an INI file.
For some examples, see:
Insert a line to a text file/template in Inno Setup before a specific line if doesn't exist yet
How can I add comments in INI file created by Inno Setup installation
Another thing that you can do, if you are creating a new INI file, is to deploy a template INI file with the formatting you want to achieve. And then use the [INI] section to only modify the keys.
[Files]
; Deploy INI file template
Source: "config.ini"; DestDir: "{app}"
[INI]
; Modify the key values, which are determined during installation only
Filename: "{app}\config.ini"; Section: "Section"; Key: "Key"; \
String: "{code:GetValue}";

Related

Inno Setup remove specific reg key after uninstall

I try to remove a registry key after uninstalling it in Windows, but I couldn't get it working somehow. I tried everything which was listed here: Inno Setup: Removing a problematic registry key left by another program
I checked different docs of Inno Setup:
https://jrsoftware.org/ishelp/index.php?topic=uninstalldeletesection
https://jrsoftware.org/ishelp/index.php?topic=isxfunc_regdeletekeyincludingsubkeys
https://jrsoftware.org/ishelp/index.php?topic=registrysection
https://jrsoftware.org/ishelp/index.php?topic=isxfunc_regdeletevalue
I ended up with this:
; Basic setup for a JavaFX application
#define AppName "Practicumopdracht OOP2"
#define AppVersion "1.0.0"
#define AppPublisher "Remzi Cavdar"
#define AppURL "https://twitter.com/remzicavdar"
#define AppExeName "practicumopdracht.jar"
#define AppExeDir "C:\Users\Remzi\Projects\student-1\out\artifacts\practicumopdracht_jar"
#define AppIcon "app.ico"
#define ProjectDir "C:\Users\Remzi\Projects\JavaFX-Setup"
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{DD7E7C3F-F4AC-4D76-8626-95019C15E111}
AppName={#AppName}
AppVersion={#AppVersion}
VersionInfoVersion=1.0.0.0
VersionInfoCopyright={#AppPublisher} - ict#remzi.info
AppVerName={#AppName}
AppPublisher={#AppPublisher}
AppPublisherURL={#AppURL}
AppSupportURL={#AppURL}
AppUpdatesURL={#AppURL}
DefaultDirName={localappdata}\Remzi Cavdar\{#AppName}
DisableProgramGroupPage=yes
PrivilegesRequired=lowest
OutputBaseFilename=Setup-practicumopdracht
Compression=lzma
SolidCompression=yes
WizardStyle=modern
UninstallDisplayName={#AppName}
UninstallDisplayIcon={app}\{#AppIcon}
MinVersion=10.0.10240
[Languages]
Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "{#AppExeDir}\{#AppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ProjectDir}\{#AppIcon}"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ProjectDir}\Input\OpenJDK19U-jre_x64_windows_hotspot_19_36.msi"; DestDir: "{tmp}"; AfterInstall: RunJavaInstaller
[Icons]
Name: "{autoprograms}\{#AppName}"; Filename: "{app}\{#AppExeName}"; IconFilename: "{app}\{#AppIcon}"
Name: "{autodesktop}\{#AppName}"; Filename: "{app}\{#AppExeName}"; IconFilename: "{app}\{#AppIcon}"; Tasks: desktopicon
[Registry]
Root: HKCU; Subkey: "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Store"; ValueType: binary; ValueName: "{app}\unins000.exe"; Flags: dontcreatekey uninsdeletevalue
[Run]
Filename: "{app}\{#AppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(AppName, '&', '&&')}}"; Flags: shellexec postinstall skipifsilent
[UninstallDelete]
Type: filesandordirs; Name: "{localappdata}\Remzi Cavdar"
[Code]
procedure RunJavaInstaller;
var
ErrorCode: Integer;
begin
if not ShellExec('', 'msiexec.exe', ExpandConstant('/i "{tmp}\OpenJDK19U-jre_x64_windows_hotspot_19_36.msi" ADDLOCAL=FeatureMain,FeatureEnvironment,FeatureJarFileRunWith,FeatureJavaHome,FeatureOracleJavaSoft /qb'), '', SW_SHOWNORMAL, ewWaitUntilTerminated, ErrorCode)
then
MsgBox('Java JRE installer failed to run!' + #13#10 + ' ' + SysErrorMessage(ErrorCode), mbError, MB_OK);
end;
This is what I'm trying to remove after uninstall:
I found a solution to my registry question. I needed to check for both 32-bit and 64-bit.
[Registry]
Root: HKCU; Subkey: "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Store"; ValueType: binary; ValueName: "{app}\unins000.exe"; Flags: dontcreatekey uninsdeletevalue
Root: HKCU64; Subkey: "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Store"; ValueType: binary; ValueName: "{app}\unins000.exe"; Flags: dontcreatekey uninsdeletevalue; Check: IsWin64
I found the answer here: Writing 32/64-bit specific registry key in Inno Setup and https://jrsoftware.org/ishelp/index.php?topic=registrysection also mention this with HKLM64 example, but I read things to fast to notice it.

Make a selection which desktop shortcut icons to create in Inno Setup

I want to make a section in my Inno Setup where the user can choose which desktop shortcuts to create. Because I plan to have 4 shortcuts, but they are not all required to work. I want a user to choose the desktop shortcuts that will be created. Here is my current script:
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; \
GroupDescription: "{cm:AdditionalIcons}"
[Files]
Source: "C:\Users\hwkru\Documents\WinUEFI\{#MyAppExeName}"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\hwkru\Documents\WinUEFI\WinUEFI-console.exe"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\hwkru\Documents\WinUEFI\WinUEFI-x86.exe"; \
DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\hwkru\Documents\WinUEFI\WinUEFI-x86-console.exe"; \
DestDir: "{app}"; Flags: ignoreversion
[Icons]
Name: "{autodesktop}\{#MyAppName}"; \
Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{autodesktop}\WinUEFI Console"; \
Filename: "{app}\WinUEFI-console.exe"; Tasks: desktopicon
Name: "{autodesktop}\WinUEFI (32-bit)"; \
Filename: "{app}\WinUEFI-x86.exe"; Tasks: desktopicon
Name: "{autodesktop}\WinUEFI (32-bit) Console"; \
Filename: "{app}\WinUEFI-x86-console.exe"; Tasks: desktopicon
Then people would not require to create all of these 4 shortcuts, as there is a 32 and 64 bit version.
Create separate task for each of your shortcuts, instead of the one desktopicon task:
[Tasks]
Name: "appdesktopicon"; Description: "Application icon"; \
GroupDescription: "{cm:AdditionalIcons}"
Name: "ueficondesktopicon"; Description: "WinUEFI Console icon"; \
GroupDescription: "{cm:AdditionalIcons}"
Name: "uefi32desktopicon"; Description: "WinUEFI (32-bit) icon"; \
GroupDescription: "{cm:AdditionalIcons}"
Name: "uefi32condesktopicon"; Description: "WinUEFI (32-bit) Console icon"; \
GroupDescription: "{cm:AdditionalIcons}"
[Icons]
Name: "{autodesktop}\{#MyAppName}"; \
Filename: "{app}\{#MyAppExeName}"; Tasks: appdesktopicon
Name: "{autodesktop}\WinUEFI Console"; \
Filename: "{app}\WinUEFI-console.exe"; Tasks: ueficondesktopicon
Name: "{autodesktop}\WinUEFI (32-bit)"; \
Filename: "{app}\WinUEFI-x86.exe"; Tasks: uefi32desktopicon
Name: "{autodesktop}\WinUEFI (32-bit) Console"; \
Filename: "{app}\WinUEFI-x86-console.exe"; Tasks: uefi32condesktopicon

Creating command-line parameters shortcut depending of language selected in Inno Setup

I am trying to use a conditional in command-line parameters - I have used this tutorial and it works great:
Creating a shortcut to execute a program with command-line parameters in Inno Setup
I am creating an installer, I would like to know how to do if the user selects the Spanish language, the created shortcut has the parameter: -spanish
#define MyAppName "The software"
#define MyAppVersion "1.0"
#define MyAppPublisher "Inc."
[Languages]
Name: "english"; MessagesFile: "compiler:Languages\English.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
[Files]
Source: "C:\Program Files (x86)\The software\*"; DestDir: "{app}"; \
Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\Soft name"; Filename: "{app}\soft.exe"; \
Parameters: "-english"; IconFilename: {app}\icon.ico;
Either use the Languages parameter:
[Icons]
Name: "{commondesktop}\Soft name"; Filename: "{app}\soft.exe"; \
Parameters: "-english"; IconFilename: {app}\icon.ico; Languages: english
Name: "{commondesktop}\Soft name"; Filename: "{app}\soft.exe"; \
Parameters: "-russian"; IconFilename: {app}\icon.ico; Languages: russian
...
Or use a scripted constant and the ActiveLanguage function. If your language Name and the switch name always matches, it is very easy:
[Icons]
Name: "{commondesktop}\Soft name"; Filename: "{app}\soft.exe"; \
Parameters: "-{code:ActiveLanguage}"; IconFilename: {app}\icon.ico
If they do not match, you will have to implement a proxy function that translates the ActiveLanguage value to an equivalent switch name.

Creating shortcut in user Start menu from elevated Inno Setup installer

During its lifetime, MyApp creates extra shortcuts to Userappdata,
MyAppGroupName\MyAppShortcut#2
MyAppGroupName\MyAppShortcut#3
...
yet as Inno Setup requires elevation because of registry Association edits the original {Group} item is inserted in a different (commonstartmenu) directory:
MyAppGroupName\MyAppShortcutAtInstallation
Very happy with the {Group} flavour in the install so
DisableProgramGroupPage=yes
is not an option at this stage. Else creating paths in Dirs like
{Userappdata}\MyAppGroupName
doesn't appear to function in the current script:
...
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
ChangesAssociations = yes
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
[Files]
; (Note: Scroll to the right to see the full lines!)
Source: "Test.exe"; DestDir: "{app}"; Flags: ignoreversion
[Icons]
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
[Registry]
Root: HKCU; Subkey: "Software\Auth/MyApp"; Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\Auth\MyApp"; ValueType: string; ValueName: "Name"; ValueData: "{app}";
;Association
Root: HKCR; Subkey: ".XXX";ValueData: "{#MyAppName}";Flags: uninsdeletevalue; ValueType: string; ValueName: ""
Root: HKCR; Subkey: "{#MyAppName}";ValueData: "Program {#MyAppName}"; Flags: uninsdeletekey; ValueType: string; ValueName: ""
Root: HKCR; Subkey: "{#MyAppName}\DefaultIcon";ValueData: "{app}\{#MyAppExeName},0";ValueType: string; ValueName: ""
Root: HKCR; Subkey: "{#MyAppName}\shell\open\command";ValueData: """{app}\{#MyAppExeName}"" ""%1""";ValueType: string;ValueName: ""
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: en; MessagesFile: "compiler:Default.isl"
Name: deu; MessagesFile: "compiler:Languages\German.isl"
Name: es; MessagesFile: "compiler:Languages\Spanish.isl"
[Dirs]
Name: "{userstartmenu}\{userstartmenu}\{#MyAppName}"
[UninstallDelete]
Type: files; Name: "{#MyAppName}.chw"
Is there any known method of pointing {Group} to {Userappdata} in an elevated scenario? Or any other helpers e.g. here?
If I understand your question correctly you are looking for a combination of {userprograms} and {groupname}:
[Icons]
Name: "{userprograms}\{groupname}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Though note that:
Your approach is flawed in general. An installer should not both require elevation and modify environment of a specific user. The elevation can change user context (e.g. if Administrator account is distinct to the regular user account). So you do not know, if the "user" is the right user.
Using groups in Start menu is against Windows guidelines for Windows 8 and newer.

Default components for silent installation with Inno Setup

I'm developing an installation file in Inno setup.
It has 3 different optional components to install when user selects 'custom'.
It works fine, but when /SILENT parameter is passed, no component is installed. I suppose because no component is checked.
...here is the code fragment related:
[Types]
Name: custom; Description: {cm:instCustom}; Flags: iscustom
Name: full; Description: {cm:instFull}
[Components]
Name: Programador; Description: {cm:cmpProgramador}; Types: full
Name: Usuario; Description: {cm:cmpUsuario}; Types: full
Name: Reporte; Description: {cm:cmpReporte}; Types: full
[Icons]
Name: {group}\{cm:cmpProgramador}; Filename: {app}\Programador\{#MyAppExeNameA}; Components: Programador
Name: {group}\{cm:cmpUsuario}; Filename: {app}\Usuario\{#MyAppExeNameB}; Components: Usuario
Name: {group}\{cm:cmpReporte}; Filename: {app}\Reporte\{#MyAppExeNameC}; Components: Reporte
Name: {group}\Desinstalar MIVES; Filename: {uninstallexe}
[Registry]
Root: HKCU; Subkey: Software\UPC; Flags: uninsdeletekey
Root: HKCU; Subkey: Software\UPC\MIVES
Root: HKLM; Subkey: Software\UPC; Flags: uninsdeletekey
Root: HKLM; Subkey: Software\UPC\MIVES
Root: HKLM; Subkey: Software\UPC\MIVES\Settings; ValueType: string; ValueName: InstallPath; ValueData: {app}
; file association depens of the components selected
Root: HKCR; Subkey: .mip; ValueType: string; ValueData: mip_auto_file; Flags: uninsdeletekey; Components: Programador
Root: HKCR; Subkey: mip_auto_file; Flags: uninsdeletekey; Components: Programador
Root: HKCR; Subkey: mip_auto_file\shell\open\command; ValueType: expandsz; ValueData: {app}\Programador\{#MyAppExeNameA} %1; Components: Programador
Root: HKCR; Subkey: .miu; ValueType: string; ValueData: miu_auto_file; Flags: uninsdeletekey; Components: Usuario
Root: HKCR; Subkey: miu_auto_file; Flags: uninsdeletekey; Components: Usuario
Root: HKCR; Subkey: miu_auto_file\shell\open\command; ValueType: expandsz; ValueData: {app}\Usuario\{#MyAppExeNameB} %1; Components: Usuario
Root: HKCR; Subkey: .mir; ValueType: string; ValueData: mir_auto_file; Flags: uninsdeletekey; Components: Reporte
Root: HKCR; Subkey: mir_auto_file; Flags: uninsdeletekey; Components: Reporte
Root: HKCR; Subkey: mir_auto_file\shell\open\command; ValueType: expandsz; ValueData: {app}\Reporte\{#MyAppExeNameC} %1; Components: Reporte
[Files]
Source: {#MyAppExeNameA}; DestDir: {app}\Programador; Flags: promptifolder; Components: Programador
Source: {#MyAppExeNameB}; DestDir: {app}\Usuario; Flags: promptifolder; Components: Usuario
Source: {#MyAppExeNameC}; DestDir: {app}\Reporte; Flags: promptifolder; Components: Reporte
I need that one of the three components (component 'Usuario') was installed by default when the /silent or /verysilent parameter is passed.
I think I have to use Check: WizardSilent, but I don't know where. In fact, I tried adding the WizardSilent in Components section, but nothing happens:
[Components]
Name: Programador; Description: {cm:cmpProgramador}; Types: full
Name: Usuario; Description: {cm:cmpUsuario}; Types: full; Check: WizardSilent
Neither in the Files section:
[Files]
Source: {#MyAppExeNameB}; DestDir: {app}\Usuario; Flags: promptifolder; Components: Usuario; Check: WizardSilent
Here is what I need:
MIVES_211.exe /SP- /verysilent >>> installs "Usuario" component by default (silent mode, and no /components parameter)
MIVES_211.exe /SP- /silent /components=Reporte >>> installs only "Reporte" component (silent mode, and components parameter)
MIVES_211.exe /SP- /silent /components=Usuario,Reporte >>> installs "Usuario" and "Reporte" components (silent mode, and components parameter)
EDITED:
I think I've found one solution, but I don't know if it is a good solution. Just added one new type including the WizardSilent check:
[Types]
Name: silent; Description: {cm:instCustom}; Check: WizardSilent
Name: custom; Description: {cm:instCustom}; Flags: iscustom
Name: full; Description: {cm:instFull}
And use it in the components section, component "Usuario" (the component I want to install by default in a silent installation):
[Components]
Name: Programador; Description: {cm:cmpProgramador}; Types: full
Name: Usuario; Description: {cm:cmpUsuario}; Types: full silent
Name: Reporte; Description: {cm:cmpReporte}; Types: full
Now, it works really as I want. But I don't like to have two types with the same description, unless only one is showed in the setup wizard.
Is it a good idea?
Thanks!
I believe your setup is conceptually wrong.
The silent installation should install whatever the typical/default/common installation is. Now it looks like the default installation is the "Full" installation, but you want the silent installation to behave differently. That does not seem right.
So you should have a default "Typical" installation type, with the "Usuario" component. Just like you have the "Silent" type now. But the "Typical" type will make sense even in an interactive installation.
[Types]
Name: typical; Description: "Typical"
Name: full; Description: "Full"
Name: custom; Description: "Custom"; Flags: iscustom
[Components]
Name: Programador; Description: "Programador"; Types: full
Name: Usuario; Description: "Usuario"; Types: full typical
Name: Reporte; Description: "Reporte"; Types: full
And anyway, the /SILENT should always be accompanied with /LOADINF or at least /COMPONENTS or /TYPE.
Your solution with "silent" type, while a hack, will work somewhat, because the Check: WizardSilent will hide this type in the interactive installation.
Btw, note that with mere /SILENT, when upgrading, the installer will use components selected in the previous (possibly interactive) installation.

Resources