Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
InnoSetup Script example
Message
From
16/09/2006 11:36:23
 
 
To
14/09/2006 13:30:49
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
01153770
Message ID:
01154383
Views:
9
Hi Tamar,

thanks again for your script. It helped me understand some more of the coding used in InnoSetup. Now all I need to do is work out how to install a Windows Service.

In case anybody is interested, here is a simplified version of what I came up with:
#define MyAppName "Samaan Systems"
#define MyAppVerName "Samaan Systems"
#define MyAppPublisher "Samaan Systems Ltd."
#define MyAppURL "http://SamaanSystems.com"
#define MyAppExeName "myprog.exe"

[Setup]
AppName={#MyAppName}
AppVerName={#MyAppVerName}
AppId=SSL1
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
AppVersion=1.0
DefaultGroupName={#MyAppVerName}
Compression=lzma
SolidCompression=true
OutputBaseFilename={#MyAppName} setup
CreateAppDir=no
LicenseFile=readme.txt
DisableProgramGroupPage=yes

[Messages]
BeveledLabel=© 2006 Samaan Systems Ltd.

[Types]
Name: workstation; Description: Workstation installation
Name: shared; Description: Shared files installation
Name: full; Description: Full installation

[Components]
Name: workstation; Description: Workstation files; Types: full workstation
Name: shared; Description: Shared files; Types: full shared

[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; components: workstation
Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked; components: workstation

[Files]
;**********************************************************************
;
;	Workstation component files
;
;**********************************************************************
Source: myprog.exe; DestDir: {code:GetAppDir}; Flags: ignoreversion; Components: workstation

;**********************************************************************
;
;	shared component files
;
;**********************************************************************
Source: readme.txt; DestDir: {code:GetDataDir}; Flags: ignoreversion; Components: shared

[Icons]
Name: {group}\{#MyAppName}; Filename: {code:GetAppDir}\MyProg.exe
Name: {commondesktop}\{#MyAppName}; Filename: {code:GetAppDir}\MyProg.exe; Tasks: desktopicon; WorkingDir: {app}; IconIndex: 0

[Run]
Filename: {app}\Myprog.exe; Description: {cm:LaunchProgram,{#MyAppName}}; Flags: nowait postinstall skipifsilent; Components: workstation

[Code]
var
   AppDirPage, DataDirPage: TInputDirWizardPage;

procedure InitializeWizard;
begin
	{ Create the app directory page }
	AppDirPage := CreateInputDirPage( wpSelectComponents,
		'Select Workstation Directory', 'Where should the workstation files be installed?',
		'Setup will install the workstation files into the following folder.',
		False, 'New Folder');
	AppDirPage.Add( 'To continue, click Next. If you would like to select a different location, click Browse');

	{ Create the data directory page }
	DataDirPage := CreateInputDirPage( wpSelectComponents,
		'Select Shared Files Directory', 'Where should the shared files be installed?',
		'Setup will install the shared files into the following folder.',
		False, 'New Folder');
	DataDirPage.Add( 'To continue, click Next. If you would like to select a different location, click Browse');

end;

procedure RegisterPreviousData( PreviousDataKey: Integer);
begin
   { Save the DataDir setting so we can restore it next time }
   SetPreviousData( PreviousDataKey, 'AppDir', AppDirPage.Values[0]);
   SetPreviousData( PreviousDataKey, 'DataDir', DataDirPage.Values[0]);
end;

procedure CurPageChanged(curPageID: Integer);

var SetupType: String;

begin

  if CurPageID = AppDirPage.ID then
  begin
    SetupType:=WizardSetupType(False);

    case SetupType of
      'full': AppDirPage.Values[0] := GetPreviousData('AppDir', ExpandConstant('{pf}') + '\Samaan Systems');
      'workstation': AppDirPage.Values[0] := GetPreviousData('AppDir', ExpandConstant('{pf}') + '\Samaan Systems');
    end;
  end;

  if CurPageID = DataDirPage.ID then
  begin
    SetupType:=WizardSetupType(False);

    case SetupType of
      'full': DataDirPage.Values[0] := GetPreviousData('DataDir', ExpandConstant('{pf}') + '\Samaan Systems\Data');
      'shared': DataDirPage.Values[0] := GetPreviousData('DataDir', ExpandConstant('{pf}') + '\Samaan Systems\Data');
    end;
  end;
end;


function ShouldSkipPage( PageID: Integer): Boolean;
begin
   { Skip the AppDir page if the shared component is not selected }
   if ( PageID = AppDirPage.ID) then
      Result := pos( 'workstation', WizardSelectedComponents( false)) = 0

   { Skip the DataDir page if the shared component is not selected }
   if ( PageID = DataDirPage.ID) then
      Result := pos( 'shared', WizardSelectedComponents( false)) = 0

end;


function UpdateReadyMemo( Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo,
   MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
   S: String;
begin
   { Fill the 'Ready Memo' with the normal settings and the custom settings }
   S := '';
   S := MemoComponentsInfo + NewLine + NewLine;

   { Workstation component is selected }
   if pos( 'workstation', WizardSelectedComponents( false)) > 0 then
      S := S + MemoDirInfo + appDirPage.Values[0] + ' (Workstation files)' + NewLine;

   { shared component is selected }
   if pos( 'shared', WizardSelectedComponents( false)) > 0 then
         S := S + DataDirPage.Values[0] + ' (Shared files)' + NewLine;

   Result := S;
end;

function GetDataDir( S: String): String;
begin
   { Return the selected DataDir }
   Result := DataDirPage.Values[0];
end;

function GetAppDir( Default: String): String;
begin
   { Return the install dir }
   Result := AppDirPage.Values[0];
end;
>>Hi,
>>
>>My installation needs to give the user the option of doing a workstation install, a shared file install or a full install (workstation and shared files). Using my current script, the user is first prompted for the directory to install the workstation files in, then the component selection page gets displayed. I'd like to display the components selection page first, then if the workstation or the full installation has been selected display the screen to select where to install the workstation files.
>>
>>Does anybody have a script that functions like this that I could have a look at?
>
>Check your inbox.
>
>Tamar
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform