Subversion Repositories factorylink.im-bas

Rev

Rev 4 | Blame | Compare with Previous | Last modification | View Log | Download

; -- im_bas.iss --
; Copyright (C) 2002 RLD Automation
; FL7.0, Windows 2000

#pragma option -v+
#pragma verboselevel 9

#define Debug
#define AppName "FactoryLink IM-BAS Driver"
#define AppVersion GetFileVersion(AddBackslash(SourcePath) + "..\..\Flink\Bin\Fl70\im_bas.exe")

[Setup]
AppName={#AppName}
;AppVerName={#AppName} version {#AppVersion}

PrivilegesRequired=admin
;RestartComputer=no
DisableStartupPrompt=yes
DisableProgramGroupPage=yes
DiskSpanning=0
;AppName=FactoryLink IM-BAS Driver
AppVerName=IM-BAS Driver Version {#AppVersion}, for FL7.0 NT4 (with SP4 or higher) or Windows 2000
AppCopyright=Copyright © 2002 RLD Automation.
DefaultDirName={code:GetPrgDir|{pf}\im_bas}
;DefaultGroupName=Wizard Information Systems
DirExistsWarning=no
MinVersion=4,4
OutputBaseFilename=ImBasInstall
OutputDir=..\..\Setup\Fl70
WizardImageFile=..\USDATAModern.bmp
WizardSmallImageFile=..\SetupModernSmall25.bmp
UsePreviousAppDir=yes
Uninstallable=true
UninstallDisplayIcon={app}\im_bas.exe
UninstallDisplayName=FactoryLink IM-BAS Driver
UninstallFilesDir={app}
AppPublisher=USDATA Nederland
AppVersion=1.5
AppPublisherURL=http://www.usdata.com
AppSupportURL=mjordaan@usdata.com
AppUpdatesURL=http://www.usdata.com
LicenseFile=..\license.txt
InfoBeforeFile=..\infobefore.txt
WizardStyle=modern
UninstallStyle=modern
WindowVisible=false
BackColor=clSilver
BackColor2=clBlack
BackColorDirection=toptobottom
;WizardDebug=no

[Types]
Name: full; Description: Full installation
;Name: "compact"; Description: "Compact installation"
Name: custom; Description: Custom installation; Flags: iscustom

[Components]
Name: main; Description: IM-BAS Driver; Types: full custom; Flags: fixed
Name: manual; Description: IM-BAS Driver Manual; Types: full
Name: alm; Description: Alarm Logger Extensions; Types: full
Name: debug; Description: IM-BAS Driver Debug Support-files; Types: full

[Files]
;FactoryLink files
Source: ..\..\Flink\Ac\im_bas.ac; DestDir: {app}\ac; Components: main
;Source: "..\..\Src\Fl70\Release\im_bas.exe"; DestDir: "{app}\bin"; Flags: ignoreversion
;Source: "..\..\Src\Fl70\FlMsgRLD.dll"; DestDir: "{sys}"; Flags: ignoreversion
Source: ..\..\Flink\Bin\Fl70\im_bas.exe; DestDir: {app}\bin; Flags: ignoreversion; Components: main
Source: ..\..\Flink\Bin\Fl70\im_bas.map; DestDir: {app}\bin; Flags: ignoreversion; Components: debug
Source: ..\..\Flink\Bin\Fl70\FlMsgRLD.dll; DestDir: {sys}; Flags: ignoreversion; Components: main
Source: ..\..\Flink\Bin\im_bas.ini; DestDir: {app}\bin; Flags: confirmoverwrite; Components: main
Source: ..\..\Flink\Bin\RLDTitle.exe; DestDir: {app}\bin; Flags: uninsneveruninstall; Components: main
Source: ..\..\Flink\Ctgen\im_bas.ctg; DestDir: {app}\ctgen; Components: main
Source: ..\..\Flink\Ctgen\im_bas.rtm; DestDir: {app}\ctgen; Components: main
Source: ..\..\Flink\Help\en\im_bas.hlp; DestDir: {app}\help\de; Components: main
Source: ..\..\Flink\Help\en\im_bas.hlp; DestDir: {app}\help\en; Components: main
Source: ..\..\Flink\Help\en\im_bas.hlp; DestDir: {app}\help\fr; Components: main
Source: ..\..\Flink\Key\En\imbasmsg.key; DestDir: {app}\key\de; Components: main
Source: ..\..\Flink\Key\En\imbasmsg.key; DestDir: {app}\key\en; Components: main
Source: ..\..\Flink\Key\En\imbasmsg.key; DestDir: {app}\key\fr; Components: main
Source: ..\..\Flink\Key\En\imbasdat.key; DestDir: {app}\key\de; Components: main
Source: ..\..\Flink\Key\En\imbasdat.key; DestDir: {app}\key\en; Components: main
Source: ..\..\Flink\Key\En\imbasdat.key; DestDir: {app}\key\fr; Components: main
;Source: "..\..\Flink\Mps\En\im_bas.mps"; DestDir: "{app}\mps\en"; Components: main
;Source: "..\..\Flink\Mps\En\im_bas.cba"; DestDir: "{app}\mps\en"; Components: main
Source: ..\..\Flink\Msg\En\im_bas.txt; DestDir: {app}\msg\de; Components: main
Source: ..\..\Flink\Msg\En\im_bas.txt; DestDir: {app}\msg\en; Components: main
Source: ..\..\Flink\Msg\En\im_bas.txt; DestDir: {app}\msg\fr; Components: main
Source: ..\..\Flink\Msg\En\imbas_ac.txt; DestDir: {app}\msg\de; Components: main
Source: ..\..\Flink\Msg\En\imbas_ac.txt; DestDir: {app}\msg\en; Components: main
Source: ..\..\Flink\Msg\En\imbas_ac.txt; DestDir: {app}\msg\fr; Components: main
Source: ..\..\Flink\Key\De\al_tsfmt.key; DestDir: {app}\key\de; Components: alm
Source: ..\..\Flink\Key\En\al_tsfmt.key; DestDir: {app}\key\en; Components: alm
Source: ..\..\Flink\Key\Fr\al_tsfmt.key; DestDir: {app}\key\fr; Components: alm
Source: ..\..\Flink\Msg\De\al_fmt.txt; DestDir: {app}\msg\de; Flags: uninsneveruninstall; Components: alm
Source: ..\..\Flink\Msg\En\al_fmt.txt; DestDir: {app}\msg\en; Flags: uninsneveruninstall; Components: alm
Source: ..\..\Flink\Msg\Fr\al_fmt.txt; DestDir: {app}\msg\fr; Flags: uninsneveruninstall; Components: alm

;Protection
Source: ..\..\Flink\bin\inst_seq.exe; DestDir: {app}; Flags: deleteafterinstall; Components: main
Source: ..\..\Flink\opt\wizard.opt; DestDir: {app}\opt; Flags: onlyifdoesntexist; Components: main
Source: {src}\wizard.opt; DestDir: {app}; Flags: deleteafterinstall external skipifsourcedoesntexist; Components: main
;Documentation
Source: {src}\im_bas.pdf; DestDir: {app}\..\Documentation\en; Flags: external skipifsourcedoesntexist; Components: manual
Source: ..\im_bas.exe; DestDir: {app}\bin; DestName: ReadMeIm_bas.exe; Flags: isreadme; Components: main

[Registry]
Root: HKLM; Subkey: SOFTWARE\USDATA\FactoryLink\Configuration Explorer\Menus\Node Classes\NC_TASKGROUP; ValueType: String; ValueName: ; ValueData: NC_TASKGROUP; Flags: noerror createvalueifdoesntexist; Components: main
Root: HKLM; Subkey: SOFTWARE\USDATA\FactoryLink\Configuration Explorer\Menus\Node Classes\NC_TASKGROUP; ValueType: String; ValueName: Opened Icon; ValueData: folderclosed; Flags: createvalueifdoesntexist; Components: main
Root: HKLM; Subkey: SOFTWARE\USDATA\FactoryLink\Configuration Explorer\Menus\Node Classes\NC_TASKGROUP; ValueType: String; ValueName: Closed Icon; ValueData: folderopened; Flags: createvalueifdoesntexist; Components: main
Root: HKLM; Subkey: SOFTWARE\USDATA\FactoryLink\Configuration Explorer\Menus\Node Classes\NC_TASKGROUP; ValueType: String; ValueName: Description; ValueData: Task Group; Flags: createvalueifdoesntexist; Components: main
Root: HKLM; Subkey: SOFTWARE\USDATA\FactoryLink\Configuration Explorer\Menus\Node Classes\NC_TASKGROUP; ValueType: String; ValueName: TG_CAPTION Device Interfaces; ValueData: Device Interfaces; Flags: createvalueifdoesntexist; Components: main
Root: HKLM; Subkey: SOFTWARE\USDATA\FactoryLink\Configuration Explorer\Menus\Node Classes\NC_TASKGROUP; ValueType: String; ValueName: Task Group Device Interfaces; ValueData: {code:GetDriverString}; Components: main
;Update utility launcher and autostart service
;Root: HKLM; Subkey: "Software\Classes\AppID\{{6BE98583-87A6-11D1-9B6C-0020AF1E9F09}"; ValueType: string; ValueName: "RunAs"; ValueData: "Interactive User"; Flags: createvalueifdoesntexist; Components: main
;Root: HKLM; Subkey: "System\CurrentControlSet\Services\FactoryLink Autostart Service"; ValueType: string; ValueName: "ObjectName"; ValueData: "LocalSystem"; Components: main

[Run]
Filename: {app}\bin\acctmgr.exe; Parameters: -c -d -v; Check: AddTitle(im_bas,im_basm im_basp im_basd); Flags: runminimized; StatusMsg: Updating FactoryLink account manager index...; Components: main
Filename: {app}\inst_seq.exe; Parameters: -MIM_BAS -S{app}\wizard.opt; Flags: runminimized; StatusMsg: Updating Wizard protection...; Components: main
Filename: {app}\bin\mkhelp.exe; Flags: runminimized; StatusMsg: Updating FactoryLik help file index...; Components: main

[UninstallRun]
Filename: {app}\bin\RLDTitle.exe; Parameters: " /REMOVE=im_bas"; Flags: runminimized; StatusMsg: Updating FactoryLink account manager index...; Components: main
Filename: {app}\bin\acctmgr.exe; Parameters: -c -d -v; Check: RemoveTitle(im_bas); Flags: runminimized; StatusMsg: Updating FactoryLink account manager index...; Components: main

[InstallDelete]
;Type: files; Name: "{app}\FlInstall.exe"

[Messages]
RunEntryShellExec=Yes, I would like to view the README file
BeveledLabel=RLD Automation

#ifdef Debug
  #expr SaveToFile(AddBackslash(SourcePath) + "Preprocessed.iss")
#endif

[Code]
var
  DriverList: String;
  TaskName: String;

function InitializeSetup(): Boolean;
{var
  MyText: String;}
begin

  {Task name specification, name is a constant of the code section}
  TaskName := 'im_bas';

  RegQueryStringValue(HKLM, 'SOFTWARE\USDATA\FactoryLink\Configuration Explorer\Menus\Node Classes\NC_TASKGROUP', 'Task Group Device Interfaces', DriverList);

  {create a driver list if there is none}
  if (DriverList = '') then begin

    DriverList := 'scale,ioxlator,edi_dev,te__,mbus,modp,mbustcp,sqrd,ab__,ab__rapd,netdtl,ktdtl,gene,asyn,omrn,sdrv,siem,h1mp,ti__,omux,ov60,mist,ldnr,t405,reli,gem_,dan2,eibi,apac2,bn90,dmod,es__,moor,rocm,tmdm,rmdm,hdp_rocm,bris,profibus,sinec_h1,s_3964r,stple,stplcnfg';
  end;

  {add our task to the driver list}
  if (Pos(TaskName,  DriverList) = 0) then begin

    DriverList := DriverList + ',' + TaskName;
  end;

  Result := True;
end;

{Read the FactoryLink directory from the autostart service program location,
 using the environment variable FLINK will result in a directory with
 short names. By using the autostart server the long names are found, and
 the setup progam will use these names instead of the notation in short}
function GetPrgDir(S: String): String;
var
  MyDir: String;
begin

  {read the autostart service directory, filename and extension}
  RegQueryStringValue( HKEY_LOCAL_MACHINE, 'System\CurrentControlSet\Services\FactoryLink Autostart Service', 'ImagePath', MyDir);

  {remove the filename and last '\' character}
  MyDir := ExtractFileDir( MyDir);

  {now the bin subdir is removed.....}
  MyDir := ExtractFileDir( MyDir);

  {return default in case no directory is found}
  if (Length( MyDir) <= 0) then begin
    MyDir := S;
  end;

  {return the directory to install the program}
  Result := MyDir;
end;

{Get the driver string for modifying the tree view of the
 Configuration Explorer}
function GetDriverString(DefaultInput: String): String;
begin
  { Return the driver list }
  Result := DriverList;
end;

{Add a AC line for the current task to the titles file, add a line
 to the CTlist file. The taskname and ct-line are specified in the
 function-parameter: taskname,ct-line}
function AddTitle( MyEntry: String): Boolean;
var
  MyText: TArrayOfString;
  MyFile: String;
  MyAC: String;
  MyCT: String;
  k: Integer;
  bText: Boolean;
  found: Integer;
begin

  {first file to load is th etitles file in the AC directory}
  MyFile := GetPrgDir( '') + '\ac\titles';
  bText := LoadStringsFromFile( MyFile, MyText);

  {AC entry looks like: taskname.ac}
  k := Pos( ',', MyEntry);
  if k = 0 then k := Pos( ':', MyEntry);
  MyAC := Copy( MyEntry, 0, k-1) + '.ac';
  MyCT := MyEntry;
  StrSet( ':', k, MyCt);

  {search for ac entry}
  found := 0;
  k := 0;
  while (k < GetArrayLength(MyText)) and (found = 0) do begin

    found := Pos( MyAC, MyText[ k]);
    k := k + 1;
  end;

  {if the entry is not found, add a line to the titles file}
  if (found = 0) then begin

    SetArrayLength(MyText, GetArrayLength(MyText)+1);
    MyText[ GetArrayLength(MyText)-1] := MyAC;
    SaveStringsToFile( MyFile, MyText, false);
  end;

  {add entry to ctlist file}
  MyFile := GetPrgDir( '') + '\ctgen\ctlist';
  bText := LoadStringsFromFile( MyFile, MyText);

  {search for ctgen entry}
  found := 0;
  k := 0;
  while (k < GetArrayLength(MyText)) and (found = 0) do begin

    found := Pos( MyCT, MyText[ k]);
    k := k + 1;
  end;

  {if the entry is not found, add a line to the ctlist file}
  if (found = 0) then begin

    SetArrayLength(MyText, GetArrayLength(MyText)+1);
    MyText[ GetArrayLength(MyText)-1] := MyCT;
    SaveStringsToFile( MyFile, MyText, false);
  end;

  {return always true, ac file must be installed, this function
   only adds a line to the titles file}
  Result := True;
end;

{Remove a AC line for the current task in the titles file, and remove
 a line in the CTlist file the entry is specified with the task name
 in the function-parameter}
function RemoveTitle( MyEntry: String): Boolean;
var
  MyText: TArrayOfString;
  MyFile: String;
  MyAC: String;
  MyCT: String;
  Temp: String;
  k: Integer;
  found: Integer;
  bText: Boolean;
begin

  MyAC := MyEntry + '.ac';
  MyCT := MyEntry + ':';

  {search the task name in the ctlist file}
  MyFile := GetPrgDir( '') + '\ctgen\ctlist';
  SetArrayLength( MyText, 0);
  bText := LoadStringsFromFile( MyFile, MyText);

  {search for the task name}
  for k:=0 to GetArrayLength(MyText)-1 do begin

    Temp := MyText[ k];
    if (found = 0) then
      found := Pos( MyCT, MyText[ k]);

    {if the entry is found, remove the line from the titles file}
    if (found <> 0) then begin

      if ((k+1) < GetArrayLength(MyText)) then begin

        MyText[ k] := MyText[ k+1];
      end else {begin;}
        MyText[ k] := '';
    end;
  end;

  if (found <> 0) then begin

    {shorten array with one}
    SetArrayLength( MyText, GetArrayLength( MyText) - 1);
    SaveStringsToFile( MyFile, MyText, false);
  end;

  {search the task name in the titles file}
  MyFile := GetPrgDir( '') + '\ac\titles';
  bText := LoadStringsFromFile( MyFile, MyText);
  found := 0;

  {search for the task name}
  for k:=0 to GetArrayLength(MyText)-1 do begin

    Temp := MyText[ k];
    if (found = 0) then
      found := Pos( MyAC, MyText[ k]);

    {if the entry is found, remove the line from the titles file}
    if (found <> 0) then begin

      if ((k+1) < GetArrayLength(MyText)) then begin

        MyText[ k] := MyText[ k+1];
      end else {begin;}
        MyText[ k] := '';
    end;
  end;

  if (found <> 0) then begin

    {shorten array with one}
    SetArrayLength( MyText, GetArrayLength( MyText) - 1);
    SaveStringsToFile( MyFile, MyText, false);
  end;

  {return always true, ac file must be removed}
  Result := True;
end;