• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1743
  • Last Modified:

Help with Inno Setup Script

Hi I am using inno setup to create an exe to install and eld file and some dll's

At the end of innosetup i want it to have a tickbox saying install eld which triggers its install which i have done as follows

[Run]
Filename: "{app}\test.ELD"; Description: "{cm:LaunchProgram,HTS}";   Flags:  postinstall shellexec

Open in new window


but it errors

"Unable to execute file:
c:\program files\test\test.eld

ShellExecuteex failed; code 1156"

How do i stop this error?

or how can i initiate this code with a tick box at the end of the setup instead?
       
var
ErrorCode: Integer;
procedure LoadELD;
begin
ShellExec('open', ExpandConstant('{app}\TS700.ELD'),'', '', SW_SHOW,
ewNoWait, ErrorCode)
end;

Open in new window


I can post the whole code if needed?

Thanks
0
DiGiTaLReePer
Asked:
DiGiTaLReePer
  • 4
  • 4
1 Solution
 
mirtheilCommented:
What application is using the ELD file?  The 1156 means "ERROR_DDE_FAIL."  
If you double click on the ELD file after the install completes, does it work?  
You might switch from the ShellExec to actually calling the program that uses the ELD file and pass the ELD file as the parameter. Something like:
 
[Run]
Filename: "<pathtoprogram>\program.exe"; Parameters: "{app}\test.ELD"; Description: "{cm:LaunchProgram,HTS}";   Flags:  postinstall shellexec

Open in new window

0
 
DiGiTaLReePerAuthor Commented:
It has mixed fealing with running the file direct..

I have had great success running this script in inno setup

 
[Code]
var
ErrorCode: Integer;
procedure LoadELD;
begin
ShellExec('open', ExpandConstant('{app}\test.ELD'),'', '', SW_SHOW,
ewNoWait, ErrorCode)
end;

Open in new window


I usually call it from here with the afteinstall parameter but i would rather it ran from a tickbox at the end.

 
Source: "C:\Users\Chris\Desktop\test.ELD"; DestDir: "{app}"; Flags: ignoreversion; AfterInstall: LoadELD

Open in new window

0
 
mirtheilCommented:
You might switch from the ShellExec to actually calling the program that uses the ELD file and pass the ELD file as the parameter. Something like the code I posted in my first answer.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
DiGiTaLReePerAuthor Commented:
can i not just call the above code from a tickbox at the end of the install?

var
ErrorCode: Integer;
procedure LoadELD;
begin
ShellExec('open', ExpandConstant('{app}\test.ELD'),'', '', SW_SHOW,
ewNoWait, ErrorCode)
end;

it works perfectly?

The trouble is the program path changes from pc to pc

Thanks
0
 
mirtheilCommented:
From the InnoSetup help:
postinstall
Valid only in a [Run] section. Instructs Setup to create a checkbox on the Setup Completed wizard page. The user can uncheck or check this checkbox and thereby choose whether this entry should be processed or not.

It does not look like you can call code from a tickbox at the end of the install.

You might be able to create your own page with a tick box and in the "next" event call your code but it'll add more code and an extra page to your installer.
0
 
DiGiTaLReePerAuthor Commented:
Ok can I get some help making this happen I'm new to this installer, thanks
0
 
mirtheilCommented:
Here's something I threw together.  Haven't really tested it:
; 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={{BC8A44BE-0724-49A7-8947-E58B8C29AFA7}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
DisableFinishedPage=Yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "C:\util\innosetup\Examples\MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

[Code]
var
  Page: TInputOptionWizardPage;
  IsRegisteredUser: Boolean;

procedure LoadELD;
var
ErrorCode: Integer;

begin
ShellExec('open', ExpandConstant('{app}\test.ELD'),'', '', SW_SHOW, ewNoWait, ErrorCode)
end;

procedure InitializeWizard();
begin
Page := CreateInputOptionPage(wpInfoAfter,
  'Finish', 'Launch ELD?',
  'If you want to launch ELD, please check the box below, then click Next.',
  False, False);

// Add items
Page.Add('Launch ELD');

// Set initial values (optional)
Page.Values[0] := True;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = Page.Id then
    WizardForm.NextButton.Caption := 'Finish';
end;

function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = Page.Id then 
  begin
  if Page.Values[0] then
    LoadELD;
  end;
Result:= true;
end;

Open in new window

0
 
DiGiTaLReePerAuthor Commented:
Great help, Thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now