Run application after successful install - inno-setup

How to make check box that allow user to run application after installation?

There you go:
under [Run]:
Filename: {app}\{cm:AppName}.exe; Description: {cm:LaunchProgram,{cm:AppName}}; Flags: nowait postinstall skipifsilent
under [CustomMessages]:
AppName=mySoftwaresNiceName
LaunchProgram=Start mySoftware after finishing installation

Check the postinstall flag in the [Run] section, see the documentation at https://jrsoftware.org/ishelp/topic_runsection.htm#postinstall

Add Filename to Run Section with Flag postinstall.
Example for Copy&Paste:
[Run]
// User selected... these files are shown for launch after everything is done
Filename: {app}\README.TXT; Description: View the README file; Flags: postinstall shellexec skipifsilent
Filename: {app}\APP.EXE; Description: Run Application; Flags: postinstall nowait skipifsilent unchecked

To make the checkbox, create a task:
[Tasks]
Name: StartAfterInstall; Description: Run application after install
and bind it to "run" action:
[Run]
Filename: {app}\{#exe}; Flags: shellexec skipifsilent nowait; Tasks: StartAfterInstall
where {#exe} is the name of exe-file

Related

Inno Setup: Disable desktop icon and autostart entry via command line parameter

I'm creating an desktop icon and an autostart entry with an Inno Setup script like this:
[Icons]
Name: "{commonstartup}\abc"; Filename: "{app}\xyz.exe"; WorkingDir: "{app}"; Flags: createonlyiffileexists; Tasks: StartMenuEntry
Name: "{commondesktop}\abc"; Filename: "{app}\xyz.exe"; WorkingDir: "{app}"; IconIndex: 0; Tasks: desktopicon
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"
Name: "StartMenuEntry"; Description: "{cm:AutoStartProgram}"; GroupDescription: "{cm:AutoStartProgramGroupDescription}"
Some users want to run my setup.exe from the command line. They want to add a parameter for silent installation /VERYSILENT and a parameter for disabling the desktop icon and the autostart entry.
Is that possible with a command line parameter? If not: What else is possible to do that? Thanks!
Use /TASKS or better /MERGETASKS command-line switches to alter the default task selection.
Particularly, to disable particular task, use /MERGETASK=!taskname:
mysetup.exe /VERYSILENT /MERGETASKS=!desktopicon,!StartMenuEntry
Related question: Command line switch to prevent Inno Setup installer from creating desktop Icon

Open HTML page from Inno Setup post install Run section entry

Is it possible to turn these [run] entries into internet hyper-links instead?
Filename: "{win}\hh.exe"; \
Parameters: "{app}\CommunityTalks.chm::/CommunityTalks.htm"; \
WorkingDir: "{app}"; \
Flags: nowait postinstall runmaximized; \
Description: "{cm:ShowOverview}"
Filename: "{win}\hh.exe"; \
Parameters: "{app}\CommunityTalks.chm::/revisions.htm"; \
WorkingDir: "{app}"; \
Flags: nowait postinstall runmaximized; \
Description: "{cm:ViewChangeHistory}"
I have managed to update my [icons] section of the script for the same two items:
Name: "{group}\Public Talks Help"; \
Filename: "https://help-pts.publictalksoftware.co.uk/pts-overview.html"
Name: "{group}\Revision History"; \
Filename: "https://help-pts.publictalksoftware.co.uk/pts-revision-history.html"
But I can't work out what the [run] counterparts should look like.
Update
So I tried:
// AJT v19.0.0 Display the Overview help topic (now uses online link)
Filename: "https://help-pts.publictalksoftware.co.uk/pts-overview.html"; \
Flags: nowait postinstall runmaximized; \
Description: "{cm:ShowOverview}"
// AJT v19.0.0 Display the Revision History help topic (now uses online link)
Filename: "https://help-pts.publictalksoftware.co.uk/pts-revision-history.html"; \
Flags: nowait postinstall runmaximized; \
Description: "{cm:ViewChangeHistory}"
And I encounter an error during install:
To open a link, you need to use shellexec flag.
Filename: "https://www.example.com/"; \
Flags: shellexec postinstall runmaximized; \
Description: "Show Overview"
With shellexec, nowait is implicit, so I have removed it.
runmaximized will probably have little effect, as the link will typically open in a new tab of an existing browser window.
Note that when opening a link from an elevated (installer) process, there's often a concern that the browser starts elevated too, what can be a security issue. Brief testing shows that the shellexec runs browser non-elevated. But I cannot tell if it is reliable.
See this topic for other solutions:
How to open a web site after uninstallation in non-elevated mode?

Create desktop link Icon after the Run section of Inno Setup

Overview
My install process involves placing over 2GB of data on a disk. So I use Inno Setup, but I run 7ZIP to actually extract/install the files.
Issue
The issue I have is that it seems the desktop icon is being created before the [Run] section, so there is no icon to set the the desktop link. Is there a way around this? (I have tried both {src} and {app} as the folder to find the icon.)
CODE
[Run]
Filename: "{pf64}\7-zip\7zG.exe"; Parameters: "x ""{src}\GL.7z"" -o""{app}\"" * -r -aoa"; \
Flags: runascurrentuser
[Icons]
Name: "{group}\EGPL Watson Uninstall"; Filename: "{uninstallexe}"; WorkingDir: "{app}"
Name: "{commondesktop}\DashBoard"; \
Filename: "{app}\dashboard\node_modules\electron\dist\electron.exe"; \
WorkingDir: "{app}\dashboard"; IconFilename: "{src}\dashboard\build\configure.ico"; \
Parameters: "main.js"; AfterInstall: SetElevationBit('{commondesktop}\DashBoard.lnk')
A quick and dirty solution is to set ChangesAssociations:
[Setup]
ChangesAssociations=yes
It makes Windows Explorer refresh all icons after the installer finishes.
A clean solution is to create the icon only after the [Run] section using CreateShellLink:
[Run]
Filename: "{pf64}\7-zip\7zG.exe"; \
Parameters: "x ""{src}\GL.7z"" -o""{app}\"" * -r -aoa"; \
Flags: runascurrentuser; AfterInstall: CreateIcon
[Code]
procedure CreateIcon;
var
IconFileName: string;
begin
IconFileName := ExpandConstant('{commondesktop}\DashBoard.lnk');
CreateShellLink(
IconFileName, '',
ExpandConstant('{app}\dashboard\node_modules\electron\dist\electron.exe'),
'main.js', ExpandConstant('{app}\dashboard'),
ExpandContant('{app}\dashboard\build\configure.ico'), 0, SW_SHOWNORMAL);
SetElevationBit(IconFileName);
end;

Inno Setup doesn't create a scheduled task

My installer should install a Windows scheduled task for the application. The task definition is provided in an XML file. Installing the XML task file interactively works fine. But the installer doesn't install the task. Since I don't see its output, I don't know whether an error message is displayed. Windows event log doesn't contain anything.
The Inno Setup task "InstallAutostart" is checked so this should be executed. The files are copied to the installation directory.
Here's the script:
[Run]
Filename: "schtasks.exe"; Parameters: "/create /tn TClockAutostart /xml ""{app}\StartTClock.xml"""; WorkingDir: "{app}"; Description: "Install task for safe automatic start"; Tasks: InstallAutostart; Check: Not IsWin64
Filename: "schtasks.exe"; Parameters: "/create /tn TClockAutostart /xml ""{app}\StartTClock64.xml"""; WorkingDir: "{app}"; Description: "Install task for safe automatic start"; Tasks: InstallAutostart; Check: IsWin64
What's wrong here? How can I debug this?

InnoSetup: How can you set the order of icons in the start menu?

I have the following [Icons] section in my Inno Setup script:
[Icons]
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\IA_Desktop.exe"; WorkingDir: {app}
Name: "{group}\{#MyAppName}"; Filename: "{app}\IA_Desktop.exe"; WorkingDir: {app}
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}
I would expect that the order of the icons in the Start Menu -> group would be:
MyAppName
MyAppUrl
Uninstall
But instead I get:
MyAppUrl
Uninstall
MyAppName
What settings or other code do I need to use to set the order of the icons in the group?
Thanks!

Resources