Leave Inno Setup DefaultDirName empty or with message "choose install directory" - inno-setup

I made a plugin for 3ds Max and I need two things:
A message "Choose your 3ds Max root" in the path field in place of "c:... or d:...".
I also need that the Next button can't be clicked, if the user didn't choose the path manually with the Browse button.
Thanks much.

Autodesk 3ds Max stores its installation directory in the Windows Registry. You can set your Inno Setup installer to check that registry entry and use it as a default.
Here's a link to the 3ds Max SDK Programmer's Guide: 3ds Max Install Directory Registry Key.

Clear the DirEdit in InitializeWizard event function. You probably want to clear it on first install only, not on re-install/upgrade. Inno Setup itself will not allow user to proceed, unless user selects the path.
You can change the messages on the "Select Destination Location" in the [Messages] section. Change entries like WizardSelectDir, SelectDirDesc, SelectDirLabel3 and SelectDirBrowseLabel.
[Messages]
WizardSelectDir=Choose install directory
[Code]
procedure InitializeWizard();
begin
if not IsUpgrade then
begin
WizardForm.DirEdit.Text := '';
end;
end;
For IsUpgrade function, see for example Inno Setup: How to overwrite on install but not on change?
Or you can create a completely new custom page:
How to ask the user to specify a folder name (using Inno Setup)?
(and hide the standard one?)

Related

Inno Setup: WizardForm from an external form

I was trying to create an installer for my new project and used an external DLL to call a function to create a custom form. Instead of using the WizardForm, can I create the WizardForm from that custom form?
Here's the code I use to create that form:
procedure NewFormCreate;
var
rt: TTimer;
begin
NewForm:= TForm.Create(nil);
NewForm.BorderStyle := bsNone;
CreateFormFromImage(NewForm.Handle, 'form.png');
rt:= TTimer.create(nil);
rt.OnTimer:= #WFProc;
rt.Interval:= 1;
rt.Enabled:= true;
NewForm.Show;
NewForm.Enabled:= False;
end;
If I understand your question correctly, you want to use your own implementation of the WizardForm.
You cannot. You can only modify the existing WizardForm. Maybe like this:
CreateFormFromImage(WizardForm.Handle, 'form.png');
You can of course create and display your own form, and prevent the WizardForm from even displaying.
But it does not make sense. The Inno Setup is all about the WizardForm. If you do not want to use it, you do not need the Inno Setup at all. Build your custom installer in Delphi (if that's your preferred IDE).
Maybe you should explain us what do you really want to achieve. It's quite probable that you have an XY problem.
Is your X problem creating an installer with irregular shape?
Instead of scripting everything manually you can use Graphical Installer for Inno Setup (http://graphical-installer.com/) and achieve something like this in few minutes:
If you use Delphi you can use RAD & Installer (http://rad-installer.com/) to create the Inno Setup installers directly from RAD Studio IDE.
Sorry for little self promo :)

Changing label texts on WizardForm page in Inno Setup

I want to change (in code) the text of certain labels on the WizardForm of the installer which are NOT exposed by the WizardForm.
Example:
ReadyLabel2a=Click Install to continue with the installation, or click Back if you want to review or change any settings.
I cannot do WizardForm.ReadyLabel2a.Caption := 'BLAH'; as the compiler complains about unknown identifier ReadyLabel2a.
Is there a way to do it?
Thanks
All components of the installer wizard form are exposed.
The label is ReadyLabel, not ReadyLabel2a. The ReadyLabel2a is ID of the message. The installer uses either message ReadyLabel2a or ReadyLabel2b for the ReadyLabel, depending on the setup configuration.
WizardForm.ReadyLabel.Caption := 'BLAH';
See TWizardForm class declaration.
You can find how the messages are used in controls in Inno Setup source code
If you need to have an installer specific texts for certain standard messages, modify the texts using Messages section:
[Messages]
ReadyLabel2a=Click Install to continue with the installation, or click Back if you want to review or change any settings.

Inno Setup: Display desktop shortcut on Finish Page

We are showing restart options on finish page as restart is required after our product installation. If we show restart options on finish page we are unable to display checkbox on finish page. Is there a way to show both restart options and checkbox on finish page.
Not directly. You have to basically implement your own set of checkboxes, and handle them on your own.
I'm doing the same in my installer. See my .iss. The Numbers in the list below point to respective lines in my code.
In InitializeWizard create a set of checkboxes on WizardForm.FinishedPage. #1144
Implement event handler for WizardForm.YesRadio.OnClick and WizardForm.NoRadio.OnClick to disable (enable) the checkboxes when user opts to restart (or not restart). As #TLama pointed out, it does not make sense to execute something, if user is going to restart the machine. #621 #1212
In CurPageChanged for CurPageID = wpFinished, place the checkboxes below WizardForm.FinishedLabel, if restarting is not needed; or below WizardForm.NoRadio.Top, if restarting is needed (if restarting is needed always, you do not need this dynamic placement). #1295
In CurStepChanged for CurPageID = wpDone, process the actions according to checkboxes, if user opted not to restart. #1443
you can do this using NeedRestart() method, as describe in following code. just set flag boolean flag ResultForRestart to true if restart required or make it false as follows
ResultForRestart: Boolean; // globel in code section
function NeedRestart(): Boolean;
begin
Result := ResultForRestart;
end;
set flag ResultForRestart true/false as you requirement it will add two radio button restart now or latter

How to hide the label at the bottom of the page in select directory page in inno setup

I want to remove the label at the bottom of the page where i select the directory to install the components. The label shows minimum disk space required to install applications.
You want to hide the DiskSpaceLabel control:
[Code]
procedure InitializeWizard;
begin
WizardForm.DiskSpaceLabel.Visible := False;
end;
That will hide the label marked on this screenshot:

Show the download progress by default and no hide button

When starting to download files from my setup, it only appears total progress and the button details to show what appears in the next image:
What I want to do is to have that step by default without hitting details button and not showing the hide button.
I assume, that we are talking about this Inno Download Plugin. On its source code page I found the idp.iss script file which seems to be an interface to the library. It contains the idpShowDetails function which if you call with the show parameter set to True will show the detail components, that you can see by clicking the details button. What remains then is hiding that details button, which in the script is accessible through the IDPForm record variable's DetailsButton member. Through this member you can set the Visible property to False to hide that button.
To realize this without modifying the original scripts you can include the following piece of code into your existing script:
procedure CurPageChanged(CurPageID: Integer);
begin
// if the downloader page was just shown, then...
if CurPageID = IDPForm.Page.ID then
begin
// show the detail components
idpShowDetails(True);
// and hide the details button
IDPForm.DetailsButton.Visible := False;
end;
end;
And a screenshot:

Resources