; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "DpackGetData" #define MyAppVersion "1.2" #define MyAppPublisher "Thamrin Brothers" #define MyAppURL "http://www.thamrin.co.id" [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={{1141F88D-8868-41E0-A87E-87DF6803E7C4} AppName={#MyAppName} AppVersion={#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion} AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={userappdata}\DPACKGetData DisableDirPage=yes DefaultGroupName={#MyAppName} DisableProgramGroupPage=yes ; Uncomment the following line to run in non administrative install mode (install for current user only.) ;PrivilegesRequired=lowest OutputBaseFilename=DpackGetDatax64 SetupIconFile=D:\node-data\Installer For 64 Bit Application\setupicon.ico UninstallDisplayIcon=D:\node-data\Installer For 64 Bit Application\setupicon.ico Compression=lzma SolidCompression=yes WizardStyle=modern PrivilegesRequired=admin CloseApplications=force [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" [Files] Source: "D:\node-data\Installer For 64 Bit Application\node-v10.16.0-x64.msi"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall Source: "D:\node-data\Installer For 64 Bit Application\sachet-sugar_icon-icons.com_61149.ico"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\node-data\Installer For 64 Bit Application\setupicon.ico"; DestDir: "{app}"; Flags: ignoreversion Source: "D:\node-data\Installer For 64 Bit Application\vcredist_x64.exe"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall Source: "D:\node-data\64bit\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "D:\node-data\Installer For 64 Bit Application\instantclient_12_2\*"; DestDir: "{app}\instant12.2_client"; Flags: ignoreversion recursesubdirs createallsubdirs [Run] Filename: "msiexec.exe"; Parameters: "/i ""{app}\node-v10.16.0-x64.msi""/quiet" Filename: "{app}\vcredist_x64.exe"; Parameters: "/q /norestart /q:a /c:""""VCREDI~3.EXE /q:a /c:""""""""msiexec /i vcredist.msi /qn"""""""" """""""; Flags: hidewizard Filename: "{app}\install.bat"; Flags: postinstall runascurrentuser; BeforeInstall: RefreshEnvironment [Registry] Root: "HKLM32"; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}\instant12.2_client";Check: NeedsAddPath('{app}\instant12.2_client') [UninstallRun] Filename: "{app}\uninstall.bat"; Flags: shellexec waituntilterminated; [Icons] Name: "{group}\icon"; Filename: "{app}\setupicon.ico"; IconFilename: "{app}\setupicon.ico"; IconIndex: 0 [Code] function NeedsAddPath(Param: string): boolean; var OrigPath: string; begin if not RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', OrigPath) then begin Result := True; exit; end; { look for the path with leading and trailing semicolon } { Pos() returns 0 if not found } Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0; end; const SMTO_ABORTIFHUNG = 2; WM_WININICHANGE = $001A; WM_SETTINGCHANGE = WM_WININICHANGE; type WPARAM = UINT_PTR; LPARAM = INT_PTR; LRESULT = INT_PTR; function SendTextMessageTimeout(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: PAnsiChar; fuFlags: UINT; uTimeout: UINT; out lpdwResult: DWORD): LRESULT; external 'SendMessageTimeoutA@user32.dll stdcall'; procedure RefreshEnvironment; var S: AnsiString; MsgResult: DWORD; begin S := 'Environment'; SendTextMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, PAnsiChar(S), SMTO_ABORTIFHUNG, 5000, MsgResult); end; const EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment'; procedure RemovePath(Path: string); var Paths: string; P: Integer; begin if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then begin Log('PATH not found'); end else begin Log(Format('PATH is [%s]', [Paths])); P := Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';'); if P = 0 then begin Log(Format('Path [%s] not found in PATH', [Path])); end else begin if P > 1 then P := P - 1; Delete(Paths, P, Length(Path) + 1); Log(Format('Path [%s] removed from PATH => [%s]', [Path, Paths])); if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then begin Log('PATH written'); end else begin Log('Error writing PATH'); end; end; end; end; procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); begin if CurUninstallStep = usUninstall then begin RemovePath(ExpandConstant('{app}\instant12.2_client')); end; end; procedure CurStepChanged(CurStep: TSetupStep); var ResultCode: Integer; wmicommand: string; ErrorCode: Integer; begin // before installing any file if CurStep = ssInstall then begin ShellExec('', ExpandConstant('{app}\uninstall.bat'), '', '', SW_SHOW, ewNoWait, ErrorCode) end; end;