I want to install the same application multiple times on the same system, for example for two user using two different web services (each one has their own).
In in my setup script I want to change the AppID and AppName based on input from the user (for example my default AppName="Service App" should be changed to AppName="Service App One" if the user has entered "One").
Above changes should be reflected in the "Select Start Menu Folder" page.
How can the Next click events for the "Select Start Menu Folder" and the "Select Destination Location" wizard pages be caught? This is required to validate the user input.
AppID can include {code...} constants (see the Inno Setup documentation), so you are free to add a custom wizard page to enter the additional string that is part of the AppID. I don't think it makes sense to do this for AppName, as according to the documentation it is used for display purposes in the wizard only.
You should insert your custom input page before the "Select Destination Location" page and try to use a {code...} constant for DefaultDirName too, using the value the user entered before.
See the CodeDlg.iss sample script for adding wizard pages and the NextButtonClick handler.
It's not a conplete answer to your question, but I thought I'd show it anyway. If you are into scripts you can maybe take it as a starting point.
In my scripts I want the copyright year (AppCopyright) to reflect the current year (when the script is build).
I use the following code:
AppCopyright=2003-{code:TodayAsYYYY} © E.De.L.Com bvba
Notice the {code:FunctionName}
In the [code] section at the end of the script I have the following routine:
function TodayAsYYYY(param:string) : string;
begin
Result := GetDateTimeString('yyyy', #0, #0);
end;
function TodayAsYYYYMMDD(param:string) : string;
begin
Result := GetDateTimeString('yyyymmdd', #0, #0);
end;
As I said, it's not a complete answer. But I use InnoSetup maybe 1, 2 weeks a year, so I can't help you any more. Hope it helps, anyway.
Hi thanks for replying after some struggle I found answers to my own question and then realised maybe I was not asking the question correctly.
The output required was having two separate installed application with their own uninstaller under the start menu and thought Changing Appid and Appname will do the trick.
Here's what I did
#define MyAppName "My Application"
[Setup]
DefaultDirName={pf}\Application\MyApp
DefaultGroupName={#MyAppName}
above two required editing which was possible in the custom pages using following
WizardForm.DirEdit.Text := 'for DefaultDirName' (Select Destination Location")
WizardForm.GroupEdit.Text:= 'DefaultGroupName'
WizardGroupValue is used for reading values of "Select Start Menu"
for accessing the next event on in built wizard I used the following
//Validate Select Start Menu and Destination values
function NextButtonClick(CurPageID: Integer): Boolean;
var
ResultCode: Integer;
begin
case CurPageID of
wpSelectDir:
begin
//Do validation
end;
wpSelectProgramGroup:
begin
//Do validation
end;
end;
Result := True;
end;
Related
Referring to the question Basic or Advanced installation mode choice to skip or use advanced options pages, I need to skip the Preparing to Install wizard page now.
In my case this page is displayed because one or more programs are using files that need to be replaced by the installer; so the installer asks to the user if they want the setup to automatically close the applications and restart at the end of the setup.
I need that this page is hide from the setup process in Basic mode, and if some files are used, that the setup automatically closes the applications using them without asking anything to the user.
I've tried editing ShouldSkipPage as:
function ShouldSkipPage(PageID: Integer): Boolean;
begin
{ If "Basic" mode is selected, skip Directory and Components pages }
Result :=
ModePage.Values[0] and
((PageID = wpSelectDir) or (PageID = wpSelectComponents) or (PageID = wpReady) or (PageID = wpPreparing));
end;
adding (PageID = wpPreparing) but the page still displayed in Basic mode.
Is there a way to implement this using Inno Setup?
ShouldSkipPage event is not even called for wpPreparing. That page is not to be skipped.
If you still want to skip it, you have to use hacks like these:
How to skip all the wizard pages and go directly to the installation process?
Inno Setup - How to close finished installer after a certain time?
With the first approach, your code would look like:
[Code]
const
BN_CLICKED = 0;
WM_COMMAND = $0111;
CN_BASE = $BC00;
CN_COMMAND = CN_BASE + WM_COMMAND;
procedure CurPageChanged(CurPageID: Integer);
var
Param: Longint;
begin
{ If Basic mode is selected, skip Preparing page }
if (CurPageID = wpPreparing) and ModePage.Values[0] then
begin
Param := 0 or BN_CLICKED shl 16;
PostMessage(WizardForm.NextButton.Handle, CN_COMMAND, Param, 0);
end;
end;
Just don't do that. Ever. It is absolutely unacceptable for you to close an arbitrary list of applications without prompting the user. It's equally impolite to barrel ahead and then require a reboot at the end of the install. (It's unforgivable to then trigger the reboot without asking.)
What you can do is to put some code in the PrepareToInstall [Code] function which will automatically close your application. This executes before the user is prompted to close apps, so if it was only your apps involved then they will not be prompted.
Is it possible to handle event when user clicks NO in uninstallation confirmation prompt?
And if NO is clicked, don't execute DeinitializeUninstall() ?
Or is it possible to handle NO button from DeinitializeUninstall() function?
Basically, I wont to avoid DelTree here:
procedure DeinitializeUninstall();
begin
{ if we are running in /SILENT mode, then this is an overinstall - }
{ don't delete additional folder}
if not UninstallSilent() then
begin
DelTree(ExpandConstant('{#BSPLOC}'),True, True, True);
end;
end;
I believe your logic is wrong. It looks like XY problem.
I do not think, that you want to detect "No". I believe, you want to run the code during or after uninstallation.
So use an event function that matches your requirements. The function is CurUninstallStepChanged. And depending on when you exactly need the code to run, check for a corresponding value of CurUninstallStep argument (usUninstall, usPostUninstall or usDone).
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usDone then
begin
{ ... }
end;
end;
For similar questions, see:
Inno Setup: Conditionally delete non-empty directory in user's home folder
How to save a folder when user confirms uninstallation? (Inno Setup)
Ntb, it also seems that you abuse the /SILENT switch to detect if the uninstaller is run automatically as part of some process (upgrade?). What if the user runs the uninstaller silently him/herself? You should add another custom switch to signal the automatic run. But that's another question.
I have a component list of more than 80 options,where user can select and then install.
The setup remembers the previous install components and automatically checks the Components, Now if user deselects all, the "Component Exist" Warning Message Box is shown.
Because user deselected all 80 options the list becomes to long and the Message box goes out of screen space and user is now stuck.
I know there is NoUninstallWarning in Messages which has the text for the warning message and takes one argument as %1
Is there a way I can change the argument value , rather than having all options listed in indiviual line , I would like to have them as comma separated?
Or if I can have a Scrollbar in the Message box?
Please help
No, this message is internal and you can't customise it like that without modifying Inno's own source code.
In that situation the user shouldn't be completely stuck -- they should be able to press ESC to return to the component selection window and then select everything again.
A simple way to avoid this problem is to not allow the user to deselect components, once installed. You can do this with a bit of code like this:
var
InstalledComponentsDisabled: Boolean;
procedure CurPageChanged(CurPageId: Integer);
var
i: Integer;
begin
if (CurPageId = wpSelectComponents) and
(WizardForm.PrevAppDir <> '') and
not InstalledComponentsDisabled then begin
InstalledComponentsDisabled := True;
for i := 0 to WizardForm.ComponentsList.Items.Count - 1 do begin
if WizardForm.ComponentsList.Checked[i] then begin
WizardForm.ComponentsList.ItemEnabled[i] := False;
end;
end;
end;
end;
This has a similar effect to making anything already installed on upgrades fixed.
An alternate option is to put disablenouninstallwarning on all of your components and then either implement the messagebox completely yourself, add a bit of static text warning about removing components permanently on the page, or even do something to actually support removing components (eg. [InstallDelete] entries or UninsHs).
I am using the Modular Dependencies scripts found here : http://www.codeproject.com/Articles/20868/NET-Framework-Installer-for-InnoSetup to install .Net and VC++.
Now, it's all well and good, and has allowed me to reduce my installer size by about 6MB.
But I want to provide the user with the fastest setup possible, and when the user already has all the necessary dependencies, he is presented with an empty "memo" screen. That's really less than optimal, and I'd wish to at least skip this step if there is nothing.
I can test if there is any component to install using if (GetArrayLength(products) = 0) then, but I can't find out where to place this test.
In the InitializeSetup function I can't find how to tell "skip this screen", and in the ShouldSkipPage function, I can't find how to tell "skip the Memo page".
Thanks !
It might be this way:
[Code]
function ShouldSkipPage(PageID: Integer): Boolean;
begin
// skip page when we are on the ready page and the memo is empty
Result := (PageID = wpReady) and (WizardForm.ReadyMemo.Text = '');
end;
I'm using Inno Script Studio to build an installer, so far very successfully as Inno Setup is a great package.
However, I want to add a warning page which is displayed when the user unchecks an important Task. I thought this would just be an easy check. After some Googling, I realised that this will require some Pascal scripting - something that I unfortunately have no knowledge of (evidence below)...
begin
if not IsTaskSelected('ImportantTask') then
WarningPage := CreateOutputMsgPage(wpSelectTasks, 'Caution',
'Please read the following important information before continuing.',
'You have not selected the ImportantTask option. Click "Back" to
reselect ImportantTask, or click "Next" to continue at your own risk.');
end;
Unsurprisingly, this didn't work.
Here are the requirements:
ImportantTask is to be checked by default.
If ImportantTask is unselected then display WarningPage with Risk Acknowledgement checkbox.
If risk acknowledgement checkbox is unticked, disable the Next button.
I didn't want to end up with a large [Code] section, but there is possibly no other option.
Thanks in advance for the help.
Use msgbox's instead wizard pages. Msgbox's are especially used for Giving any indication(info,warning..etc) to user..
This script works as per your requirement.
[Setup]
AppName=MySetup
AppVersion=1.5
DefaultDirName={pf}\MySetup
[Tasks]
Name: "ImportantTask"; Description: "This task should be selected"; GroupDescription: "Important tasks";
[Code]
function NextButtonClick(CurPageID: Integer): Boolean;
begin
Result := True;
if (CurPageID = wpSelectTasks) and not IsTaskSelected('ImportantTask') then
Result := Msgbox('You have not selected the ImportantTask option.' + #13#10 +
'Are you sure you want to continue ?', mbInformation, MB_YESNO) = IDYES;
end;
credit goes to TLama...