;================================= 09-04-2019 ===== ; CMS S.p.A. - UX-HMI Office ; ; Setup for Active ; Inno Setup Compiler version 5.6.0 ;================================================== #define AppName "CMS Active" #define SCMAppName "Maestro Active cnc" #define FolderName "Active" #define SCMIcoName "SCM.ico" #define MyAppVersion "1.5.5" #define MyAppPublisher "CMS" #define MyAppURL "https://www.scmgroup.com/it/cms" #define MyAppExeName "Active.exe" #define ProjectPath "C:\Users\ext_lmascherone\Documents\cms_step\Step\" #define MySourcePath "C:\Users\ext_lmascherone\Documents\cms_step\Step\bin" #define WwwRootPath "C:\Users\ext_lmascherone\Documents\cms_step\Step\wwwroot" #define IconsPath "C:\Users\ext_lmascherone\Documents\cms_step\Step\Desktop_Link\" #define InvDialPath "C:\Users\ext_lmascherone\Documents\cms_inverterdiagnosis\CMSInverterDiagnosis\bin\Release\" #define SinumerikPath1 "{pf}\Siemens\Sinumerik\HMIsl\siemens\sinumerik\hmi\autostart\" #define SinumerikPath2 "C:\Siemens\Sinumerik\HMIsl\siemens\sinumerik\hmi\autostart\" #define SinumerikPath3 "{pf}\Siemens\MotionControl\siemens\sinumerik\hmi\autostart\" #define SinumerikAppName "Sinumerik HMI" #define SinumerikAppExeName "run_hmi.exe" ; Support installers ; .Net #define DotNetInstallerPath "C:\Users\ext_lmascherone\Documents\Per installazioni Active\" #define DotNetInstallerName "NDP462-KB3151800-x86-x64-AllOS-ENU.exe" ; MariaDb #define MariaDBInstallerPath "C:\Users\ext_lmascherone\Documents\Per installazioni Active\" #define MariaDBInstallerName "mariadb-10.3.13-winx64.msi" [Setup] AppName={#AppName} AppVersion={#MyAppVersion} AppVerName={#AppName} {#MyAppVersion} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DisableDirPage=true DisableProgramGroupPage=yes Compression=lzma SolidCompression=true VersionInfoVersion={#MyAppVersion} VersionInfoCompany={#MyAppPublisher} VersionInfoTextVersion={#MyAppVersion} VersionInfoCopyright={#MyAppPublisher} DefaultDirName = C:\CMS\{#FolderName}\{#FolderName} WindowVisible=false PrivilegesRequired=admin ; Setup installation type [Types] Name: custom; Description: CMS installation; Flags: iscustom ; Set NC types, this types are used to configure server config file [Components] Name: Fanuc; Description: {#AppName} {cm:ForFanucNC}; Types: custom; Flags: exclusive Name: Osai; Description: {#AppName} {cm:ForOsaiNC}; Types: custom; Flags: exclusive Name: Siemens; Description: {#AppName} {cm:ForSiemensNC}; Types: custom; Flags: exclusive [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl" [CustomMessages] english.CreateStartupIcon=Create Startup &icon english.CreateSinumerikIcons=Create &Sinumerik HMI icons english.ForDemoNC=for DEMO NC english.ForFanucNC=for FANUC NC english.ForOsaiNC=for OSAI NC english.ForSiemensNC=for SIEMENS NC italian.CreateStartupIcon = Crea il collegamento in &Esecuzione Automatica italian.CreateSinumerikIcons = Crea le icone di &Sinumerik HMI italian.ForDemoNC=per CN DEMO italian.ForFanucNC=per CN FANUC italian.ForOsaiNC=per CN OSAI italian.ForSiemensNC=per CN SIEMENS english.InstallDotNet = Install .Net 4.6.2 english.InstallMariaDB = Install MariaDB italian.InstallDotNet = Installa .Net 4.6.2 italian.InstallMariaDB = Installa MariaDB italian.InstallingMariaDB = Installando MariaDB english.InstallingMariaDB = Installing MariaDB italian.InstallingDotNet = Installando .Net english.InstallingDotNet = Installing .Net [Tasks] Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone; Components: Fanuc Osai Siemens Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: checkablealone; Components: Fanuc Osai Siemens Name: startupicon; Description: {cm:CreateStartupIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: checkablealone; Components: Fanuc Osai Siemens Name: sinumerikicons; Description: {cm:CreateSinumerikIcons}; GroupDescription: {cm:AdditionalIcons}; Flags: checkablealone; Components: Siemens [Files] Source: "{#MySourcePath}\Thermo.Active.exe"; DestDir: "{app}"; Flags: ignoreversion ; Path to exe resources (dll, xml, config) Source: "{#MySourcePath}\*.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Fanuc Osai Siemens Source: "{#MySourcePath}\*.xml"; DestDir: "{app}"; Flags: ignoreversion; Components: Fanuc Osai Siemens Source: "{#MySourcePath}\*.config"; DestDir: "{app}"; Flags: ignoreversion; Components: Fanuc Osai Siemens ; Configuration files Source: "{#MySourcePath}\Config\*.xml"; DestDir: "{app}\Config\"; Flags: ignoreversion; Components: Fanuc Osai Siemens; Check: GetOverwriteConfig; ; Osai Library Source: "{#MySourcePath}\CndexLinkDotNet.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Osai ; Languages Source: "{#MySourcePath}\Language\*.*"; DestDir: "{app}\Language\"; Flags: ignoreversion; Components: Osai Source: "{#MySourcePath}\languages\*.*"; DestDir: "{app}\languages\"; Flags: ignoreversion; Components: Fanuc Osai Siemens ; Client copy Source: "{#MySourcePath}\Client\x64\*.*"; DestDir: "{app}\Client\"; Flags: recursesubdirs ignoreversion; Components: Fanuc Osai Siemens; AfterInstall: DeleteLocalStorage ; WWWRoot Files Source: "{#WwwRootPath}\favicon.ico"; DestDir: "{app}\view\"; Flags: ignoreversion; Components: Fanuc Osai Siemens Source: "{#WwwRootPath}\index.html"; DestDir: "{app}\view\"; Flags: ignoreversion; Components: Fanuc Osai Siemens ; WWWRoot Directories Source: "{#WwwRootPath}\dist\*"; DestDir: "{app}\view\dist\"; Flags: recursesubdirs ignoreversion; Components: Fanuc Osai Siemens Source: "{#WwwRootPath}\libs\*"; DestDir: "{app}\view\libs\"; Flags: recursesubdirs ignoreversion; Components: Fanuc Osai Siemens Source: "{#WwwRootPath}\assets\*"; DestDir: "{app}\view\assets\"; Flags: recursesubdirs ignoreversion; Components: Fanuc Osai Siemens Source: "{#WwwRootPath}\scripts\*"; DestDir: "{app}\view\scripts\"; Flags: recursesubdirs ignoreversion; Components: Fanuc Osai Siemens ; SCM Icon Source: {#IconsPath}{#SCMIcoName}; DestDir: "{app}"; Flags: ignoreversion; Components: Fanuc Osai Siemens; Check: GetStyleOption; ;.Net Installer Source: {#DotNetInstallerPath}\{#DotNetInstallerName}; DestDir: {tmp}; Flags: deleteafterinstall; ;Check: FrameworkIsNotInstalled Source: {#MariaDBInstallerPath}\{#MariaDBInstallerName}; DestDir: {tmp}; Flags: deleteafterinstall; ; --- UTILS ; Fanuc scripts - TEAMVIEWER Source: "{#ProjectPath}\Utility\*"; DestDir: "{app}\..\Utility\"; Flags: recursesubdirs ignoreversion; Components: Fanuc Osai Siemens ; Inverter Dialog Source: "{#InvDialPath}\*"; DestDir: "{app}\..\Utility\Cms_Inverter_Diagnosis\"; Flags: recursesubdirs ignoreversion; Components: Fanuc Osai Siemens ; Client SCM Style Source: {#ProjectPath}\SCM_Client_Config.xml; DestDir:"{app}\Client\"; DestName: "Config.xml"; Flags: ignoreversion; Components: Fanuc Osai Siemens; Check: GetStyleOption; [Icons] ; Default icons Name: {group}\{#AppName}; Filename: {app}\{#MyAppExeName}; Components: Fanuc Osai; Check: NOT GetStyleOption; Name: {userdesktop}\{#AppName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon; Components: Fanuc Osai; Check: NOT GetStyleOption; Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#AppName}; Filename: {app}\{#MyAppExeName}; Tasks: quicklaunchicon; Components: Fanuc Osai; Check: NOT GetStyleOption; Name: {userstartup}\{#AppName}; Filename: {app}\{#MyAppExeName}; Tasks: startupicon; Components: Fanuc Osai; Check: NOT GetStyleOption; ; Siemens startup icon with parameters "-start ..." Name: {group}\{#AppName}; Filename: {code:SiemensPath}{#SinumerikAppExeName}; Parameters: -start {app}\{#MyAppExeName}; IconFilename: "{app}\{#MyAppExeName}"; Components: Siemens; Check: NOT GetStyleOption; Name: {userdesktop}\{#AppName}; Filename: {code:SiemensPath}{#SinumerikAppExeName}; Parameters: -start {app}\{#MyAppExeName}; IconFilename: "{app}\{#MyAppExeName}"; Tasks: desktopicon; Components: Siemens; Check: NOT GetStyleOption; Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#AppName}; Filename: {code:SiemensPath}{#SinumerikAppExeName}; Parameters: -start {app}\{#MyAppExeName}; IconFilename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon; Comment: {#AppName}; Components: Siemens; Check: NOT GetStyleOption; Name: {userstartup}\{#AppName}; Filename: {code:SiemensPath}{#SinumerikAppExeName}; Tasks: startupicon; IconFilename: "{app}\{#MyAppExeName}"; Parameters: -start {app}\{#MyAppExeName}; Components: Siemens; Check: NOT GetStyleOption; ; SCM ICONS ; Default icons Name: {group}\{#SCMAppName}; Filename: {app}\{#MyAppExeName}; IconFilename: {app}\{#SCMIcoName}; Components: Fanuc Osai; Check: GetStyleOption; Name: {userdesktop}\{#SCMAppName}; Filename: {app}\{#MyAppExeName}; IconFilename: {app}\{#SCMIcoName}; Tasks: desktopicon; Components: Fanuc Osai; Check: GetStyleOption; Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#SCMAppName}; Filename: {app}\{#MyAppExeName}; IconFilename: {app}\{#SCMIcoName}; Tasks: quicklaunchicon; Components: Fanuc Osai; Check: GetStyleOption; Name: {userstartup}\{#SCMAppName}; Filename: {app}\{#MyAppExeName}; IconFilename: {app}\{#SCMIcoName}; Parameters: -start {app}\{#MyAppExeName}; Tasks: startupicon; Components: Fanuc Osai; Check: GetStyleOption; ; SCM Siemens startup icon with parameters "-start ..." Name: {group}\{#SCMAppName}; Filename: {#IconsPath}{#SinumerikAppExeName}; Parameters: -start {app}\{#MyAppExeName}; IconFilename: {app}\{#SCMIcoName}; Components: Siemens; Check: GetStyleOption; Name: {userdesktop}\{#SCMAppName}; Filename: {#IconsPath}{#SCMIcoName}; Parameters: -start {app}\{#MyAppExeName}; IconFilename: {app}\{#SCMIcoName}; Tasks: desktopicon; Components: Siemens; Check: GetStyleOption; Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#SCMAppName}; Filename: {code:SiemensPath}{#SinumerikAppExeName}; Parameters: -start {app}\{#MyAppExeName}; IconFilename: {app}\{#SCMIcoName};Tasks: quicklaunchicon; Components: Siemens; Check: GetStyleOption; Name: {userstartup}\{#SCMAppName}; Filename: {code:SiemensPath}{#SinumerikAppExeName}; Parameters: -start {app}\{#MyAppExeName}; IconFilename: {app}\{#SCMIcoName}; Tasks: startupicon; Components: Siemens; Check: GetStyleOption; [Run] ; Install .net Filename: {tmp}\{#DotNetInstallerName}; Description: {cm:InstallDotNet}; WorkingDir:{tmp}; StatusMsg: {cm:InstallingDotNet}; Check: NetFrameworkNeedInstall ;Check: NetFrameworkIsMissing ; Install MariaDb Filename: "msiexec.exe"; Description: {cm:InstallDotNet}; WorkingDir:{tmp}; StatusMsg: {cm:InstallingMariaDB}; Parameters: "/i {tmp}\{#MariaDBInstallerName}"; Check: CheckHeidiSQLNeedInstall; /// MinVersion: 10 [Registry] Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "Active"; ValueData: "C:\CMS\ACTIVE\Active\Active.exe"; Components: Fanuc Osai; MinVersion: 10; Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "Active"; ValueData: "C:\Program Files (x86)\Siemens\MotionControl\siemens\sinumerik\hmi\autostart\run_hmi.exe -start C:\CMS\Active\Active\Active.exe"; Components: Siemens; MinVersion: 10; [Code] ///////////// SiemensPath /////////////////////////////// var CheckBoxIni: TCheckBox; CustomInputOptionCMSorSCM: TInputOptionWizardPage; IsSCM: Boolean; OverwriteConfig: Boolean; function GetStyleOption: Boolean; begin Result := IsSCM; end; ////////////////// GetSiemens Path /////////////////// function SiemensPath(S: String): string; var sSiemensPath: string; sSelectedSinumerikDir: string; begin if DirExists(ExpandConstant('{#SinumerikPath3}')) then sSiemensPath := ExpandConstant('{#SinumerikPath3}') else if DirExists(ExpandConstant('{#SinumerikPath2}')) then sSiemensPath := ExpandConstant('{#SinumerikPath2}') else if DirExists(ExpandConstant('{#SinumerikPath1}')) then sSiemensPath := ExpandConstant('{#SinumerikPath1}') else begin if (sSelectedSinumerikDir = '') then BrowseForFolder('Sinumerik folder not found!'#13#10'Select Sinumerik folder containing run_hmi.exe'#13#10'ex: '+ExpandConstant('{#SinumerikPath1}'), sSelectedSinumerikDir, False); sSiemensPath := sSelectedSinumerikDir + '\' ; end; Result := sSiemensPath ; end; ///////////////// Check .NET Framework 4.6.2 //////////////////////////////////// function NetFrameworkNeedInstall(): Boolean; var bSuccess: Boolean; regVersion: Cardinal; begin Result := True; bSuccess := RegQueryDWordValue(HKLM, 'Software\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', regVersion); if (True = bSuccess) and (regVersion >= 394802) then begin Result := False; end; end; ///////////// Check heidiSQL ///////////////// function CheckHeidiSQLNeedInstall: Boolean; begin if FileExists(ExpandConstant('C:\Program Files (x86)\Common Files\MariaDBShared\HeidiSQL\heidisql.exe')) then Result:= false else begin Result:= True end; end; ///////////////// CreateCustomInputOptionCMsorSCM ////////////////////////// procedure CreateCustomInputOptionCMSorSCM; begin CustomInputOptionCMSorSCM := CreateInputOptionPage(wpSelectComponents, 'Seleziona lo stile:', '', '', True, False); //Add Fields CustomInputOptionCMSorSCM.Add('CMS'); CustomInputOptionCMSorSCM.Add('SCM'); // Set initial values (optional) CustomInputOptionCMSorSCM.Values[0] := True; end; /////////////////// CheckConfigExistence ///////////////////////////// function OverwriteConfigModal: Boolean; begin if DirExists(ExpandConstant('C:\CMS\Active\Active\Config')) then begin // Ask the user a Yes/No question, defaulting to No if not (MsgBox('La cartella "Config" esiste giĆ . Vuoi sovrascriverla?', mbConfirmation, MB_YESNO) = IDYES) then begin // user clicked NO Result:= false; Exit; end; end; Result:= True; end; function GetOverwriteConfig: Boolean; begin Result:= OverwriteConfig; end; /////////////////// DeleteLocalStorage ////////////////////// procedure DeleteLocalStorage; begin DelTree(ExpandConstant('{app}\Client\LocalStorage'), True, True, True); end; ///////////// InitializeWizard ////////////////////////// procedure InitializeWizard(); begin CreateCustomInputOptionCMSorSCM; OverwriteConfig := OverwriteConfigModal; end; procedure CurStepChanged(CurStep: TSetupStep); begin if CustomInputOptionCMSorSCM.Values[0] then IsSCM := false else IsSCM := true; if CurStep = ssPostInstall then begin DeleteLocalStorage; end; end;