How run exe in InnoSetup? - installation

does not run the command file.
ShellExec ('', ExpandConstant ('{src}\dotNetFx40_Client_x86_x64.exe'),'','', SW_SHOW, ewNoWait, ErrorCode);
it just passes it.
[Files]
Source: C:\Users\User\Documents\Visual Studio 2010\Projects\TrainerRoomSetup\TrainerRoomSetup\Debug\DotNetFX40Client\dotNetFx40_Client_x86_x64.exe; DestDir: {app}; Flags: ignoreversion

ExtractTemporaryFile('dotNetFx40_Client_x86_x64.exe');
ShellExec('', ExpandConstant('{tmp}\dotNetFx40_Client_x86_x64.exe'), '', '', SW_SHOW, ewNoWait, ErrorCode);

Related

Installing Microsoft Access Database Engine prerequisite without user intervention in Inno Setup

I am continuing with my work in Inno Setup, So now I have a new questions about it.
I am trying of to execute some programs before install my final application, for this purpose I am using Exec function.
When I try with the following code:
[Files]
Source: "AccessDatabaseEngine_x64.exe"; DestDir: "{tmp}"; Flags: dontcopy noencryption
Source: "Database.accdb"; DestDir: "{app}"; Flags: ignoreversion
[Code]
function PrepareToInstall(var NeedsRestart: Boolean): String;
Var
ResultCode: Integer;
begin
ExtractTemporaryFile('AccessDatabaseEngine_x64.exe');
if Exec(ExpandConstant('{tmp}\AccessDatabaseEngine_x64.exe'), 'quit', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
msgbox('True: {tmp}\AccessDatabaseEngine_x64.exe : ' + IntToStr(ResultCode), mbInformation, MB_OK);
end
else begin
msgbox('False: {tmp}\AccessDatabaseEngine_x64.exe : ' + SysErrorMessage(ResultCode), mbInformation, MB_OK);
end;
end;
I get this error:
On the other hand, if I use the follow code:
[Files]
Source: "AccessDatabaseEngine_x64.exe"; DestDir: "{tmp}"; Flags: dontcopy noencryption
Source: "Database.accdb"; DestDir: "{app}"; Flags: ignoreversion
[Code]
function PrepareToInstall(var NeedsRestart: Boolean): String;
Var
ResultCode: Integer;
begin
ExtractTemporaryFile('AccessDatabaseEngine_x64.exe');
if Exec(ExpandConstant('{tmp}\AccessDatabaseEngine_x64.exe'), '', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
msgbox('True: {tmp}\AccessDatabaseEngine_x64.exe : ' + IntToStr(ResultCode), mbInformation, MB_OK);
end
else begin
msgbox('False: {tmp}\AccessDatabaseEngine_x64.exe : ' + SysErrorMessage(ResultCode), mbInformation, MB_OK);
end;
end;
I get the installation wizard of the another file. Some like this:
I want to install my other programs automatically, without user intervention.
Is it possible? Can you help me?
Thank for advance!
The usage screen says /quiet, and you use quit.
So use /quiet, not quit:
if Exec(ExpandConstant('{tmp}\AccessDatabaseEngine_x64.exe'), '/quiet', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
I was inattentive, the correct answer is in the first picture. The word that should be used is: /quiet; not /quite, not /quit.
As support (if this happens again to someone other) I leave the next link:
Description of the command-line switches that are supported by a software installation package, an update package, or a hotfix package that was created by using Microsoft Self-Extractor
.
Likewise many thaks for you attention.
The option needed is :
/passive Runs the update without any interaction from the user.
if Exec(ExpandConstant('{tmp}\AccessDatabaseEngine_x64.exe'), '/passive', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then

Inno Setup Procedure not executing after install

I have compiled multiple programs in inno setup i.e
Sql Server
.Net framework 3.5
Crystal Reports
Sql Script
the problem i am facing is that the procedure in which the code of executing the script is present does not execute after the installation of a program before it. If the program before it is cancelled then it execute.
[Files]
Source: "E:\Inno Data\Inno_Setup\Prerequisites\dotnetfx35\NDP451-KB2858728-x86-x64-AllOS-ENU.exe"; DestDir: {tmp}; AfterInstall: InstallFramework
Source: "E:\Inno_Setup\Prerequisites\CrystalReports105\CRRuntime_64bit_13_0_5.msi"; DestDir: {tmp}; AfterInstall: InstallCrystalReports
Source: "E:\Prerequisites\SQLServer2008R2SP2\SQLEXPRWT_x64_ENU.exe"; DestDir: {tmp}
;SQL Script Files
Source: "E:\SQLInstallTEST\Scripts\RCabSoft.sql"; DestDir:"{app}\Scripts"
[Run]
Filename: "{tmp}\SQLEXPRWT_x64_ENU.exe"; Parameters: "/ACTION=Install /INSTANCENAME=MSSQLSERVER /QS /HIDECONSOLE /INDICATEPROGRESS=""False"" /IAcceptSQLServerLicenseTerms /SQLSVCACCOUNT=""NT AUTHORITY\SYSTEM"" /SQLSYSADMINACCOUNTS=""builtin\users"" /SKIPRULES=""RebootRequiredCheck"" "; Check: isWin64();
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\CRRuntime_64bit_13_0_5.msi"" /qb"; WorkingDir: {tmp};
Filename: "{tmp}\NDP451-KB2858728-x86-x64-AllOS-ENU.exe"; parameters: "/SILENT /NOCANCEL"; AfterInstall: sqlscript;
[Code]
procedure sqlscript;
var
ResultCode: Integer;
OutputText: String;
begin
if FileExists(ExpandConstant('{pf32}\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\SSMS.exe')) then
begin
ExtractTemporaryFile('RCabSoft.sql');
// Execute SQL Update Scripts
Exec('SqlCmd.exe', ' -e -E -S .' + ExpandConstant(' -i "{tmp}\RCabSoft.sql"'), '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
end;
end;

Download a file while installing by inno setup

[Files]
Source: D:\VBproject\YY\inst\YY.exe; DestDir: {app}; Flags: ignoreversion
Source: D:\VBproject\YY\inst\YY.dll; DestDir: {app}; Flags: ignoreversion
That is my file list above, and I want to install the YY.dll from the internet for example
http://www.example.com/yy.dll , not pack it to setup.exe
Is there any way can do that? Thanks alot
I have used the ISTool plugin:
#include 'C:\Program Files (x86)\ISTool\isxdl.iss'
[Code]
const
dotnetRedistURL = 'http://www.example.com/yy.dll ';
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
isxdl_AddFile(dotnetRedistURL, ExpandConstant('{app}\data\yy.dll'));
isxdl_SetOption('Updating', 'Updating to the latest DLL...');
isxdl_SetOption('Please wait...', 'Updating...');
isxdl_DownloadFiles(WizardForm.Handle);
end;
end;

I have duplicated InitializeSetup in INNO SETUP how can i solve it?

Hello i am trying to make an installer using INNO SETUP, when i started to use ISSkin Code Inno setup send me an error mesage DUPLICATE IDENTIFIER 'INITIALIZESETUP' I would like to know what i have to change to my code to make it work.
I was reading at internet and i found a program called IS Script Joiner, i used it but it doesnt work.
Here is my Inno Code:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Myprogram"
#define MyAppVersion "2.8"
#define MyAppPublisher "Myprogram"
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "program.exe"
#define ISSI_WizardSmallBitmapImage "wpBanner.bmp"
#define ISSI_WizardSmallBitmapImage_x 495
#define ISSI_WizardSmallBitmapImage_Align
#define ISSI_IncludePath "C:\ISSI"
#include ISSI_IncludePath+"\_issi.isi"
[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={{2A8CE1DB-2FDB-4CAA-8A2C-0FE3DB8A500D}
AppName=Myprogram
AppVersion=2.8
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher=Myprogram
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\Myprogram
DefaultGroupName={#MyAppName}
LicenseFile=C:\Libraries\EULA.rtf
OutputDir=C:\Users\Hans Lopez\INNO SETUPS
OutputBaseFilename=programoutput
SetupIconFile=C:\Libraries\Icon.ico
Compression=lzma/Max
SolidCompression=true
WizardImageFile=C:\InstallMlockPackage\Setupbanner.bmp
AppVerName=2.8
DirExistsWarning=yes
VersionInfoProductName=Myprogram
VersionInfoProductVersion=2.8
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
[Dirs]
Name: "{app}" ; Permissions: everyone-full
Name: {sd}\myprogramfolder; Permissions: everyone-full;
[Code]
//===================================================================Verify if Installed===============================================================================
function GetUninstallString: string;
var
sUnInstPath: string;
sUnInstallString: String;
begin
Result := '';
sUnInstallString := '';
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
Result := sUnInstallString;
end;
function IsUpgrade: Boolean;
begin
Result := (GetUninstallString() <> '');
end;
function InitializeSetup: Boolean;
var
V: Integer;
iResultCode: Integer;
sUnInstallString: string;
begin
Result := True; // in case when no previous version is found
if RegValueExists(HKEY_LOCAL_MACHINE,'Software\Microsoft\Windows\CurrentVersion\Uninstall\ {2A8CE1DB-2FDB-4CAA-8A2C-0FE2DB8A500D}_is1', 'UninstallString') then //Your App GUID/ID
begin
V := MsgBox(ExpandConstant('Myprogram is Already installed, Do you want to continue?'), mbInformation, MB_YESNO); //Custom Message if App installed
if V = IDYES then
begin
sUnInstallString := GetUninstallString();
sUnInstallString := RemoveQuotes(sUnInstallString);
Exec(ExpandConstant(sUnInstallString), '', '', SW_SHOW, ewWaitUntilTerminated, iResultCode);
Result := True; //if you want to proceed after uninstall
//Exit; //if you want to quit after uninstall
end
else
Result := False; //when older version present and not uninstalled
end;
end;
//====================================================================Unistall and Delete Everything==================================================================
procedure DeleteBitmaps(ADirName: string);
var
FindRec: TFindRec;
begin
if FindFirst(ADirName + '\*.*', FindRec) then begin
try
repeat
if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0 then begin
if (FindRec.Name <> '.') and (FindRec.Name <> '..') then begin
DeleteBitmaps(ADirName + '\' + FindRec.Name);
RemoveDir(ADirName + '\' + FindRec.Name);
end;
end else if Pos('.bmp', AnsiLowerCase(FindRec.Name)) > 0 then
DeleteFile(ADirName + '\' + FindRec.Name);
until not FindNext(FindRec);
finally
FindClose(FindRec);
end;
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usUninstall then begin
if MsgBox('Do you want to delete all data files?', mbConfirmation,
MB_YESNO) = IDYES
then begin
DeleteBitmaps(ExpandConstant('{app}'));
end;
end;
end;
//===========================================================ISSKinCODE=============================================================================
// Importing LoadSkin API from ISSkin.DLL
procedure LoadSkin(lpszPath: String; lpszIniFileName: String);
external 'LoadSkin#files:isskin.dll stdcall';
// Importing UnloadSkin API from ISSkin.DLL
procedure UnloadSkin();
external 'UnloadSkin#files:isskin.dll stdcall';
// Importing ShowWindow Windows API from User32.DLL
function ShowWindow(hWnd: Integer; uType: Integer): Integer;
external 'ShowWindow#user32.dll stdcall';
function InitializeSetup(): Boolean;
begin
ExtractTemporaryFile('iTunesB.msstyles');
LoadSkin(ExpandConstant('{tmp}\iTunesB.msstyles'), '');
Result := True;
end;
procedure DeinitializeSetup();
begin
// Hide Window before unloading skin so user does not get
// a glimpse of an unskinned window before it is closed.
ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0);
UnloadSkin();
end;
/////////////////////////////////////////////////////////////ENDCODE/////////////////////////////////////////////////////////////////////////////////////////////////
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: " {cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: " {cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
[Files]
Source: "C:\My program\program.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Program Files\C:\My program\*"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\programfolder\*"; DestDir: "{sd}\Myprogramfolder"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ISSkin.dll; DestDir: {app}; Flags: dontcopy
Source: "C:\InstallMlockPackage\ISSkin\iTunesB\iTunesB\iTunesB.msstyles"; DestDir: " {tmp}"; Flags: dontcopy
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: " {app}\icon.ico" ;
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"; IconFilename: "{app}\icon.ico" ;
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; IconFilename: "{app}\icon.ico" ;
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon; IconFilename: "{app}\icon.ico" ;
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon; IconFilename: "{app}\icon.ico" ;
Name: {group}\Uninstall =ISSkin; Filename: {app}\unins000.exe
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram, {#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
Thank You very Much for Your Help
Relocate the two calls to the ISSkin DLL from where they are now (above the second InitializeSetup) to just above the first InitializeSetup declaration.
// Importing LoadSkin API from ISSkin.DLL
procedure LoadSkin(lpszPath: String; lpszIniFileName: String);
external 'LoadSkin#files:isskin.dll stdcall';
// Importing UnloadSkin API from ISSkin.DLL
procedure UnloadSkin();
external 'UnloadSkin#files:isskin.dll stdcall';
Change the first InitializeSetup code to include the calls to extract and load the skin (from the second InitializeSetup).
function InitializeSetup: Boolean;
var
V: Integer;
iResultCode: Integer;
sUnInstallString: string;
begin
// These two lines moved from second InitializeSetup declaration before it
// was removed.
ExtractTemporaryFile('iTunesB.msstyles');
LoadSkin(ExpandConstant('{tmp}\iTunesB.msstyles'), '');
Result := True; // in case when no previous version is found
if RegValueExists(HKEY_LOCAL_MACHINE,'Software\Microsoft\Windows\CurrentVersion\Uninstall\ {2A8CE1DB-2FDB-4CAA-8A2C-0FE2DB8A500D}_is1', 'UninstallString') then //Your App GUID/ID
begin
V := MsgBox(ExpandConstant('Myprogram is Already installed, Do you want to continue?'), mbInformation, MB_YESNO); //Custom Message if App installed
if V = IDYES then
begin
sUnInstallString := GetUninstallString();
sUnInstallString := RemoveQuotes(sUnInstallString);
Exec(ExpandConstant(sUnInstallString), '', '', SW_SHOW, ewWaitUntilTerminated, iResultCode);
Result := True; //if you want to proceed after uninstall
//Exit; //if you want to quit after uninstall
end
else
Result := False; //when older version present and not uninstalled
end;
end;
Remove the second InitializeSetup code entirely.

The project of Inno Setup for Windows 64-bit

I had created the project via Inno Setup for Windows 64-bit (e.g. Win 7 / 8).
After Installed I have detected that the files of the handbook can not open!
Code of my project the Inno Setup below.
How can I solve it problem?
Where my error in it the project?
#define MyAppName "MyProgram"
#define MyAppVersion "1.0.0"
#define MyAppPublisher "Publish Inc."
#define MyAppURL "http://www.mydomen.com/"
#define MyAppExeName "myprogram.exe"
[Setup]
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
LicenseFile=C:\Users\path_to_my_program\Win64\Debug\license-ru.txt
InfoAfterFile=C:\Users\path_to_my_program\Win64\Debug\readme-ru.txt
OutputDir=C:\Users\Documents\Inno Setup\Setups
OutputBaseFilename=myprogramsetup64
SetupIconFile=C:\Users\path_to_my_program\myprogram_Icon.ico
Compression=lzma2
SolidCompression=yes
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: " {cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "C:\Users\path_to_my_program\Win64\Debug\myprogram.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\path_to_my_program\Win64\Debug\SQLite3.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\path_to_my_program\Win64\Debug\help\handbook-ru.pdf"; DestDir: "{app}\help"; Flags: ignoreversion
Source: "C:\Users\path_to_my_program\Win64\Debug\help\handbook-en.pdf"; DestDir: "{app}\help"; Flags: ignoreversion
[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
After Installed I can not to open from my program the help files - handbook-ru.pdf and handbook-en.pdf. It is problem.
I had in my program used code:
procedure TForm1.MenuItem1Click(Sender: TObject);
var
path_to_handbook : WideString;
begin
case language of
$0019 : path_to_handbook := 'help\handbook-ru.pdf'; // Russian
$0009 : path_to_handbook := 'help\handbook-en.pdf'; // English
end;
ShellExecuteW(Handle, nil, PWideChar(path_to_handbook), nil, nil, SW_SHOWNORMAL);
end;
In debug and runtime the help files had been to open excellent!
And still...
The program is normally installed only with the rights of the administrator.
If Installed with the administrator right then the help files not open and the my program - working well.
If Installed without the administrator right then the help files open well but the my program - working with errors.
Any ideas how to correct a code in Inno Setup.
Thank you very much.

Resources