How can I use innosetup to automatically download files from Microsoft - download

I am using InnoSetup Tools Downloader plugin from here.
It enables downloading external internet files during installation.
While it can work in many cases, but in some case like this:
itd_addfile('http://download.microsoft.com/download/1/d/b/1dbee406-9b5f-48c5-b901-dd1a3f3c4669/Merlin.exe',expandconstant('{tmp}\Merlin.exe'));
It complains with the following:
Sorry, the files could not be downloaded. Check your connection and
click ''Retry'' to try downloading the files again, or click
''Cancel'' to terminate setup.
WE can use webbrowser to open and download:
http://download.microsoft.com/download/1/d/b/1dbee406-9b5f-48c5-b901-dd1a3f3c4669/Merlin.exe
Why it cannot be automatically downloaded by itdownload?
How to fix it?
Below is the modified example1 which caused the problem.
#define MyAppName "My Program"
#define MyAppVerName "My Program 1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.mycompany.com"
[Setup]
AppName={#MyAppName}
AppVerName={#MyAppVerName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=example1
Compression=lzma
SolidCompression=true
CreateAppDir=true
ShowLanguageDialog=yes
[Languages]
Name: english; MessagesFile: compiler:Default.isl
#include ReadReg(HKEY_LOCAL_MACHINE,'Software\Sherlock Software\InnoTools\Downloader','ScriptPath','');
[Code]
procedure InitializeWizard();
begin
itd_init;
//Let's download two zipfiles from MS Agent website..
itd_addfile('http://download.microsoft.com/download/1/d/b/1dbee406-9b5f-48c5-b901-dd1a3f3c4669/Merlin.exe',expandconstant('{tmp}\Merlin.exe'));
//Start the download after the "Ready to install" screen is shown
itd_downloadafter(wpReady);
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssInstall then begin //Lets install those files that were downloaded for us
filecopy(expandconstant('{tmp}\Merlin.exe'),expandconstant('{app}\Merlin.exe'),false);
end;
end;

Related

How to set "Error Return Code" for listing in MicrosoftStore with InnoSetup

I want to use Inno Setup to list an exe file on MicrosoftStore.
When registering an app on the MicrosoftStore dashboard, I am asked to register an "Error Return Code" for the exe file.
The following image is a capture showing the list of them.
They are textualized as follows.
-Installation cancelled by user
-Application already exists
-Installation already in progress
-Disk space is full
-Reboot requiresd
-Network failure
-Package rejected during installation
-Installation successful
Past StackOverFlow questions and answers about error codes.
They were helpful, but in the case of InnoSetup error codes, the return code can be "2" or "5" if the user cancels from finding.
In contrast, there is only one registered entry for error codes in the Microsoft Store.
In such a case, is it necessary to customize the InnoSetup return code?
What code should I write in InnoSetup?
The following code is my InnoSetup code.
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "testApp"
#define MyAppVersion "1.00"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "test.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={{3D8E37F3-FB32-4AF9-8C64-58C37D542248}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DisableProgramGroupPage=yes
; Uncomment the following line to run in non administrative install mode (install for current user only.)
;PrivilegesRequired=lowest
OutputDir=C:\Users\taichi\Desktop
OutputBaseFilename=mysetup
Compression=lzma
SolidCompression=yes
WizardStyle=modern
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "C:\Users\taichi\Desktop\dist\test\test.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\taichi\Desktop\dist\test\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
It seems that the "Add More" link is there for the very reason:
To allow you to add both 2 and 5.

WizardImageFile does not work in Inno Setup 5.5.8

I installed the latest version of Inno Setup v5.5.8 (a) and now I can not view the WizardImageFile bitmap file in my installation wizard. It worked just fine in a the previous version. Am I doing something wrong or its a bug? Here a script example I created with the help of the Inno Setup wizard it self.
Of course the setup_inno.bmp and setup_inno_small.bmp are in the same folder as the iss script file. The small image works just fine and the setup_inno.bmp is 24bit color depth (Windows format) with 164X314 pixels width and height.
Any recommendation?
Regards,
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "My Program"
#define MyAppVersion "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={{EF909D9F-7C2F-46E8-9BBF-C65D3323A436}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
WizardImageFile=setup_inno.bmp
WizardSmallImageFile=setup_inno_small.bmp
WindowStartMaximized=yes
WindowShowCaption=no
WindowVisible=yes
BackColor=$000000
BackColor2=$FFFFFF
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "C:\Program Files (x86)\Inno Setup 5\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{commonprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
Are you aware that the Welcome page is by default skipped since Inno Setup 5.5.7?
As recommended by Microsoft's desktop applications guideline, DisableWelcomePage now defaults to yes. ... The defaults in all previous versions were no.
So you can actually see the WizardImageFile on the last (Finished) page only, not on the first (Welcome) page already as previously.
I found this answer. It states:
The WizardImageFile is shown on the Welcome and Finish pages. However, the Welcome page is skipped by default now (see DisableWelcomePage), so it will normally only be visible on the Finished page. (This is enabled by default, but it is possible that you disabled that too -- see DisableFinishedPage.)
The WizardSmallImageFile is shown on all other pages.
That explains why I can’t see the images. Wonder by the Welcome Page is off by default?
I found this which states:
Don't use Welcome pages—make the first page functional whenever possible. Use an optional Getting Started page only when:
The wizard has prerequisites that are necessary to complete the wizard successfully.
Users may not understand the purpose of the wizard based on its first Choice page, and there isn't room for further explanation.
The main instruction for Getting Started pages is "Before you begin:".

Inno Setup not creating registry entry in Software/Microsoft/Windows/CurrentVersion/Uninstall

I've got the following Inno Setup script:
#define MyAppName "MyApp"
#define MyAppVersion "1.0"
#define MyAppPublisher "MyAppPublisher"
#define MyAppURL "http://www.myapppublisher.com"
[Setup]
AppId={{8D4D5A09-FD64-4C0F-94D9-19F22C827074}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf64}\MyCompany\MyApp
DefaultGroupName=MyCompany
AllowNoIcons=yes
OutputDir=C:\tmp
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: ...
[Run]
Filename: ...
It doesn't do anything special. The [Files] and [Run] sections are quite standard. My program is installed fine and I can run it OK.
The problem is that when I go to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall I cannot see an entry with my AppId. I've checked HKEY_CURRENT_USER just in case but it's not there either. I need to access that key to check if there is already an installation of my program. I've rebooted my PC but that didn't help.
There is an entry in "Control Panel - Uninstall a program" for my program.
I'm running:
Windows 7
Inno 5.5.5

I want to create setup file with Inno Setup

I need help with Inno Setup. First of all I want to sorry about my english. I hope you understand me.
I have this script:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "My software - BETA"
#define MyAppVersion "1.5"
#define MyAppExeName "My software.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={{009E8058-565E-43F7-BEAD-34E283BCA6F4}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
LicenseFile=D:\My software\EULA.rtf
OutputBaseFilename=My software - 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: "D:\My software\My software.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\My software\settings.txt"; DestDir: "{userappdata}\My software"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
The setup works but I want to add several options to the setup:
1) If the software is already installed then I want that will be an option that give the usere the ability to choose whether to overwrite the previous settings..
something like checkbox: "Don't overwrite the previous settings"
and in by default the setup will not overwrite the previous settings.
2) In the uninstaller I want the option: "Remove also the settings" (something like that) and by default this option is unchecked
3) I want that the option "Create a desktop icon" will always be checked by default.
I noticed that this option is checked by default only if the icon is already created before.
Thanks for helpers!
Gil.
Answers for your question:
1-If you are installing a application which is already install it should give user uninstalling
option.To keep Previous setting you can use Flags: onlyifdoesntexist for [Files], or
Flags: createvalueifdoesntexist for [Registry].
2-Put the following code in [Code] section,it should give user to removeing setting option.
[Code]
procedure CurUninstallStepChanged (CurUninstallStep: TUninstallStep);
var
mres : integer;
begin
case CurUninstallStep of
usPostUninstall:
begin
mres := MsgBox('Do you want to Remove Settings?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2)
if mres = IDYES then
DelTree(ExpandConstant('{userdocs}\Myapp'), True, True, True);
end;
end;
end;
3-If you want the icon task Will be checked then remove the Flags: unchecked part from [Task] section.

Having trouble automating the opening of a non-exe file using INNO Setup and Shellexec

I have done a considerable amount of searching for a solution to what i believe is a very simple answer. I am a very novice INNO Setup Users, so please excuse the question.
I have an Excel file which i want to open after installation. The install process works just fine however i am unable to have the excel file launch automatically on Setup completion. It's my understanding that ShellExec is used to launch non-exe files, however I believe i have this line incorrect.
Any and all help would be greatly appreciated. Here are the snippets of the code which i believe apply to this issue
#define MyAppName "MyApplication"
#define MyAppExeName "MyApplication.xlsm"
[Setup]
AppName={#MyAppName}
DefaultDirName={pf}\{#MyAppName}
OutputDir=C:\Documents and Settings\Test\Desktop
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
[Files]
Source: "C:\\MyApplication.xlsm"; DestDir: "{app}"; Flags: ignoreversion
[ShellExec]
Shellexec('',{#MyAppExeName},'','',SW_HIDE,ewWaitUntilTerminated,ResultCode)
Thank you for taking the time to aid me on this issue.
[Run]
Filename: {app}\{#MyAppExeName}; Description: Run {#MyAppName}; Flags: postinstall shellexec
Replace your [ShellExec] section (which is not recognised by the compiler so will just be ignored) with the above.

Resources