; Script generated by the Inno Script Studio Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! [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={{2F7B0828-9403-40C5-8F0F-E04A0F6EC55B} AppName=DPACKGetData AppVersion=1.2 ;AppVerName=DPACKGetData 1 AppPublisher=Thamrin Brother AppPublisherURL=http://thamrin.co.id/ AppSupportURL=http://thamrin.co.id/ AppUpdatesURL=http://thamrin.co.id/ DefaultDirName={userappdata}\DPACKGetData DefaultGroupName=DPACKGetData OutputBaseFilename=DpackGetDatax86 SetupIconFile=D:\node-data\Installer For 32 Bit Application\setupicon.ico UninstallDisplayIcon=D:\node-data\Installer For 32 Bit Application\setupicon.ico Compression=lzma SolidCompression=yes DisableDirPage=yes PrivilegesRequired=admin CloseApplications=force [Files] Source: "node-v10.16.0-x86.msi"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall Source: "D:\node-data\32bit\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "sachet-sugar_icon-icons.com_61149.ico"; DestDir: "{app}"; Flags: ignoreversion Source: "vcredist_x86.exe"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall Source: "instant12.2_client\*"; DestDir: "{app}\instant12.2_client"; Flags: ignoreversion recursesubdirs createallsubdirs ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Run] Filename: "{app}\bin\checkservice.bat"; Parameters: "install"; Flags: runhidden Filename: "msiexec.exe"; Parameters: "/i ""{app}\node-v10.16.0-x86.msi""/quiet" Filename: "{app}\vcredist_x86.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; [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;