Link to home
Create AccountLog in
Avatar of jasbirbrar
jasbirbrar

asked on

Automatically starting application after installation using Innosetup

I am using innosetup to write Installation script.
On the last page of the wizard, I have shown a checkbox. On click of "Finish" button i need to check the
status of the check box. If this checkbox is unchecked I need to automatically start the installaed application.
Thanks
Avatar of Mirtheil
Mirtheil
Flag of United States of America image

Usually it's the other way around.  If the checkbox at the end of the install is checked, the application will start.  The attached code shows how to do that.  Here's an excerpt from the docs as well:
postinstall
Valid only in a [Run] section. Instructs Setup to create a checkbox on the Setup Completed wizard page. The user can uncheck or check this checkbox and thereby choose whether this entry should be processed or not. Previously this flag was called showcheckbox

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
 
#define MyAppName "My Program"
#define MyAppVerName "My Program 1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "MyProg.exe"
 
[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={{63809439-8292-4117-A004-BAF4CB7BDC71}
AppName={#MyAppName}
AppVerName={#MyAppVerName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
 
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
 
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
 
[Files]
Source: "C:\util\innosetup\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
 
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
 
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#MyAppName}}"; Flags: nowait postinstall skipifsilent

Open in new window

Avatar of jasbirbrar
jasbirbrar

ASKER

In my case I have a checkbox on the "Finished" page. When this checkbox is checked an EXE is started
(say a.exe). But when this checkbox is left unchecked I want to run the application's exe.
Why?  That seems opposite of what the user would expect.
From a.exe, some settings are made(depending upon User's inputs) and then actual application is launched.
For some reasons if the user does not check the a.exe checkbox then my application won't be started.
Another solution for this could be that I somehow make mandatory to open a.exe from Innosetup script.
Can you help here?
ASKER CERTIFIED SOLUTION
Avatar of Mirtheil
Mirtheil
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
I removed the POSTInstall flag and instead put in the WAITUNTILIDLE
Thank you, I removed the check box and application run directly

[Run]
Filename: "{app}\{#SettingsAppName}"; Description: "{cm:LaunchProgram,{#StringChange(SettingsAppName, '&', '&&')}}"; Flags: shellexec skipifsilent;