Dpack get data Node : V10
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

152 line
4.7 KiB

  1. ; Script generated by the Inno Script Studio Wizard.
  2. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
  3. [Setup]
  4. ; NOTE: The value of AppId uniquely identifies this application.
  5. ; Do not use the same AppId value in installers for other applications.
  6. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
  7. AppId={{2F7B0828-9403-40C5-8F0F-E04A0F6EC55B}
  8. AppName=DPACKGetData
  9. AppVersion=1.2
  10. ;AppVerName=DPACKGetData 1
  11. AppPublisher=Thamrin Brother
  12. AppPublisherURL=http://thamrin.co.id/
  13. AppSupportURL=http://thamrin.co.id/
  14. AppUpdatesURL=http://thamrin.co.id/
  15. DefaultDirName={userappdata}\DPACKGetData
  16. DefaultGroupName=DPACKGetData
  17. OutputBaseFilename=DpackGetDatax86
  18. SetupIconFile=D:\node-data\Installer For 32 Bit Application\setupicon.ico
  19. UninstallDisplayIcon=D:\node-data\Installer For 32 Bit Application\setupicon.ico
  20. Compression=lzma
  21. SolidCompression=yes
  22. DisableDirPage=yes
  23. PrivilegesRequired=admin
  24. CloseApplications=force
  25. [Files]
  26. Source: "node-v10.16.0-x86.msi"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall
  27. Source: "D:\node-data\32bit\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
  28. Source: "sachet-sugar_icon-icons.com_61149.ico"; DestDir: "{app}"; Flags: ignoreversion
  29. Source: "vcredist_x86.exe"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall
  30. Source: "instant12.2_client\*"; DestDir: "{app}\instant12.2_client"; Flags: ignoreversion recursesubdirs createallsubdirs
  31. ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
  32. [Run]
  33. Filename: "{app}\bin\checkservice.bat"; Parameters: "install"; Flags: runhidden
  34. Filename: "msiexec.exe"; Parameters: "/i ""{app}\node-v10.16.0-x86.msi""/quiet"
  35. Filename: "{app}\vcredist_x86.exe"; Parameters: "/q /norestart /q:a /c:""""VCREDI~3.EXE /q:a /c:""""""""msiexec /i vcredist.msi /qn"""""""" """""""; Flags: hidewizard
  36. Filename: "{app}\install.bat"; Flags: postinstall runascurrentuser; BeforeInstall: RefreshEnvironment
  37. [Registry]
  38. 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')
  39. [UninstallRun]
  40. Filename: "{app}\uninstall.bat"; Flags: shellexec waituntilterminated;
  41. [Code]
  42. function NeedsAddPath(Param: string): boolean;
  43. var
  44. OrigPath: string;
  45. begin
  46. if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
  47. 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
  48. 'Path', OrigPath)
  49. then begin
  50. Result := True;
  51. exit;
  52. end;
  53. { look for the path with leading and trailing semicolon }
  54. { Pos() returns 0 if not found }
  55. Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
  56. end;
  57. const
  58. SMTO_ABORTIFHUNG = 2;
  59. WM_WININICHANGE = $001A;
  60. WM_SETTINGCHANGE = WM_WININICHANGE;
  61. type
  62. WPARAM = UINT_PTR;
  63. LPARAM = INT_PTR;
  64. LRESULT = INT_PTR;
  65. function SendTextMessageTimeout(hWnd: HWND; Msg: UINT;
  66. wParam: WPARAM; lParam: PAnsiChar; fuFlags: UINT;
  67. uTimeout: UINT; out lpdwResult: DWORD): LRESULT;
  68. external 'SendMessageTimeoutA@user32.dll stdcall';
  69. procedure RefreshEnvironment;
  70. var
  71. S: AnsiString;
  72. MsgResult: DWORD;
  73. begin
  74. S := 'Environment';
  75. SendTextMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0,
  76. PAnsiChar(S), SMTO_ABORTIFHUNG, 5000, MsgResult);
  77. end;
  78. const
  79. EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
  80. procedure RemovePath(Path: string);
  81. var
  82. Paths: string;
  83. P: Integer;
  84. begin
  85. if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then
  86. begin
  87. Log('PATH not found');
  88. end
  89. else
  90. begin
  91. Log(Format('PATH is [%s]', [Paths]));
  92. P := Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';');
  93. if P = 0 then
  94. begin
  95. Log(Format('Path [%s] not found in PATH', [Path]));
  96. end
  97. else
  98. begin
  99. if P > 1 then P := P - 1;
  100. Delete(Paths, P, Length(Path) + 1);
  101. Log(Format('Path [%s] removed from PATH => [%s]', [Path, Paths]));
  102. if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then
  103. begin
  104. Log('PATH written');
  105. end
  106. else
  107. begin
  108. Log('Error writing PATH');
  109. end;
  110. end;
  111. end;
  112. end;
  113. procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
  114. begin
  115. if CurUninstallStep = usUninstall then
  116. begin
  117. RemovePath(ExpandConstant('{app}\instant12.2_client'));
  118. end;
  119. end;
  120. procedure CurStepChanged(CurStep: TSetupStep);
  121. var
  122. ResultCode: Integer;
  123. wmicommand: string;
  124. ErrorCode: Integer;
  125. begin
  126. // before installing any file
  127. if CurStep = ssInstall then
  128. begin
  129. ShellExec('', ExpandConstant('{app}\uninstall.bat'),
  130. '', '', SW_SHOW, ewNoWait, ErrorCode)
  131. end;
  132. end;