ultimo не помогло
[more=Скрипт]
Код: ; Скрипт создан через Мастер Inno Setup Script.
; ИСПОЛЬЗУЙТЕ ДОКУМЕНТАЦИЮ ДЛЯ ПОДРОБНОСТЕЙ ИСПОЛЬЗОВАНИЯ INNO SETUP!
#define MyAppName "AIMP"
#define MyAppVersion "4.00.1687"
#define Exe "AIMP.exe"
#include "WinTB.iss"
#include "botva2.iss"
#include "BrowseForm.iss"
[Setup]
; Примечание: Значение AppId идентифицирует это приложение.
; Не используйте одно и тоже значение в разных установках.
; (Для генерации значения GUID, нажмите Инструменты | Генерация GUID.)
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=true
OutputBaseFilename={#MyAppName} {#MyAppVersion} Final RePack (& Portable) by Pilot
SetupIconFile=ico.ico
Compression=lzma2/Ultra64
SolidCompression=true
InternalCompressLevel=Ultra64
ShowLanguageDialog=yes
UninstallDisplayIcon={uninstallexe}
UninstallFilesDir={app}\Uninstall
DisableFinishedPage=yes
RawDataResource=Botva:botva2.dll|b2p:b2p.dll|Logo:logo.png|LiPic:LiPic.png
AppModifyPath={app}
VersionInfoProductName={#MyAppName}
DirExistsWarning=no
DisableReadyPage=true
AppID={#MyAppName}
VersionInfoDescription={#MyAppName} RePack by Pilot
AppCopyright=Pilot © 2015
VersionInfoVersion={#MyAppVersion}
VersionInfoProductVersion={#MyAppVersion}
VersionInfoCopyright=Pilot © 2015
UninstallDisplayName={#MyAppName}
ComponentsListTVStyle=true
ShowComponentSizes=false
Uninstallable=not IsComponentSelected('AIMP\P')
DisableProgramGroupPage=yes
CreateUninstallRegKey=not IsComponentSelected('AIMP\P')
InfoBeforeFile=Info.rtf
DisableWelcomePage=true
RestartIfNeededByRun=false
[Languages]
Name: "R"; MessagesFile: "Russian.isl"
Name: "E"; MessagesFile: "English.isl"
Name: "U"; MessagesFile: "Ukrainian.isl"
[Types]
Name: full; Description: Полная установка; Flags: iscustom
[Tasks]
Name: ic; Description: {cm:AdditionalIcons}; Components: AIMP\I;
Name: ic\desktop; Description: {cm:CreateDesktopIcon}; Components: AIMP\I;
Name: ic\group; Description: {cm:CreateStartMenuIcon}; Components: AIMP\I;
Name: ic\quicklaunch; Description: {cm:CreateQuickLaunchIcon}; OnlyBelowVersion: 0,6.1; Components: AIMP\I; Flags: unchecked
Name: ic\taskbar; Description: {cm:PinTaskbarIcon}; MinVersion: 0.0,6.1.7600; Components: AIMP\I; Flags: unchecked
Name: ic\startmenu; Description: {cm:PinStartMenuIcon}; MinVersion: 0.0,6.1.7600; Components: AIMP\I; Flags: unchecked
Name: aimp; Description: {#MyAppName}; Components: AIMP\I;
Name: aimp\i; Description: Интегрировать в Windows; Components: AIMP\I;
Name: aimp\r; Description: Ассоциировать {#MyAppName} с аудио файлами и плейлистами; Components: AIMP\I;
Name: aimp\m; Description: Добавить пункт в конекстное меню Проводника Windows; Components: AIMP\I;
[Components]
Name: AIMP; Description: {#MyAppName}; Flags: fixed disablenouninstallwarning; Types: full;
Name: AIMP\I; Description: Установить {#MyAppName}; Flags: exclusive disablenouninstallwarning
Name: AIMP\P; Description: Распаковать {#MyAppName}; Flags: exclusive disablenouninstallwarning
[Files]
;Файлы распаковываемые в папку с игрой. Необходимы для деинсталлятора;
Source: WinTB.dll; Flags: dontcopy;
; Примечание: Не используйте "Flags: ignoreversion" для системных файлов
Source: {app}\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs;
[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\{#Exe}; Components: AIMP\I; Tasks: ic\group;
Name: {group}\{#MyAppName} Advanced Tag Editor; Filename: {app}\AIMPate.exe; Components: AIMP\I; Tasks: ic\group;
Name: {group}\{#MyAppName} Audio Converter; Filename: {app}\AIMPac.exe; Components: AIMP\I; Tasks: ic\group;
Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Filename: {uninstallexe}; Components: AIMP\I; Tasks: ic\group;
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#Exe}; Components: AIMP\I; Tasks: ic\desktop;
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}; Filename: {app}\{#Exe}; Components: AIMP\I; Tasks: ic\quicklaunch;
[Run]
Filename: {app}\{#Exe}; Tasks: aimp\i; Parameters: "/REG=I"; Components: AIMP\I;
Filename: {app}\{#Exe}; Tasks: aimp\r; Parameters: "/REG=R"; Components: AIMP\I;
Filename: {app}\{#Exe}; Tasks: aimp\m; Parameters: "/REG=MENU"; Components: AIMP\I;
[UninstallRun]
Filename: {app}\{#Exe}; Parameters: "/REG=UALL"; Components: AIMP\I;
[
Code]
#ifdef UNICODE
#define A "W"
#else
#define A "A"
#endif
#define A = (Defined UNICODE) ? "W" : "A"
const
///////////////////////////////////Относится к лого и изображениям мастера
RT_RCDATA = 10;
LOAD_LIBRARY_AS_DATAFILE = $2;
var
///////////////////////////////////Лого и изображения
lPLogo, lPicHandle: THandle;
BtnImage: TBitmapImage;
NewGroupBox1: TNewGroupBox;
NewCheckBox1: TNewCheckBox;
///////////////////////////////////////////
iInitialize: Boolean;
///////////////////////////////////Ресурсы(относится к лого и изображениям мастера)
function GetFromRes(const ResName, SaveFileName: String): Boolean;
var
lResStream: TResourceStream;
begin
lResStream := TResourceStream.Create(HInstance, ResName, RT_RCDATA);
try
lResStream.SaveToFile(AddBackslash(ExpandConstant('{tmp}')) + SaveFileName);
finally
lResStream.Free;
Result := FileExists(AddBackslash(ExpandConstant('{tmp}')) + SaveFileName);
end;
end;
function OnShouldSkipPage(Sender: TWizardPage): Boolean;
begin
if WizardForm.ComponentsList.Items.Count > 0 then WizardForm.Tag:= 1; // отображаются страницы выбора папки и компонентов
end;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
Confirm:=False;
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
if PageID=wpPreparing then
Result:=true;
end;
procedure InitializeWizard;
begin
PageFromID(wpSelectDir).OnShouldSkipPage:= @OnShouldSkipPage
with WizardForm do
begin
///////////////////////////////////Логотип и изображения мастера
iInitialize := True;
if GetFromRes('_IS_BOTVA', 'botva2.dll') and GetFromRes('_IS_B2P', 'b2p.dll') and GetFromRes('_IS_LOGO', 'logo.png') and GetFromRes('_IS_LIPIC', 'LiPic.png') then
begin
///////////////////////////////////Изображения
lPicHandle := ImgLoad(MainPanel.Handle, ExpandConstant('{tmp}\LiPic.png'), WizardSmallBitmapImage.Left, WizardSmallBitmapImage.Top, WizardSmallBitmapImage.Width, WizardSmallBitmapImage.Height, True, True);
WizardSmallBitmapImage.Hide;
ImgSetVisibility(lPicHandle, True);
ImgApplyChanges(MainPanel.Handle);
DiskSpaceLabel.Hide;
ComponentsDiskSpaceLabel.Hide;
InfoBeforeClickLabel.Hide;
SelectDirBitmapImage.Hide;
SelectDirBrowseLabel.Hide;
////////////////////////////////////////////
NewGroupBox1 := TNewGroupBox.Create(WizardForm);
with NewGroupBox1 do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(0);
Top := ScaleY(124);
Width := ScaleX(417);
Height := ScaleY(57);
Caption := 'Папка установки';
end;
with WizardForm.DirBrowseButton do
begin
Parent := NewGroupBox1;
SetBounds(ScaleX(333),ScaleY(20),ScaleX(75),ScaleY(23));
Caption:='Обзор...';
OnClick:=@BrowseClick;
end;
with WizardForm.DirEdit do
begin
Parent := NewGroupBox1;
Left := ScaleX(12);
Top := ScaleY(22);
Width := ScaleX(312);
end;
///////////////////////////////////Логотип
lPLogo:= ImgLoad(WizardForm.Handle, ExpandConstant('{tmp}\logo.png'), ScaleX(20), ScaleY(320), ScaleX(118), ScaleY(35), True, True);
ImgApplyChanges(WizardForm.Handle);
end;
///////////////////////////////////WinTB
ExtractTemporaryFile('WinTB.dll');
TaskBarV10(MainForm.Handle, WizardForm.Handle, false, false, 0, 0, _m_);
//////////////////////////////////////
NewCheckBox1 := TNewCheckBox.Create(WizardForm);
with NewCheckBox1 do
begin
Parent := WizardForm.InfoBeforePage;
SetBounds(ScaleX(0), ScaleY(216), ScaleX(417), ScaleY(17));
Caption := 'Посетить сайт автора | repackbypilot.blogspot.com';
Enabled := True;
end;
with InfoBeforeMemo do
begin
Top := ScaleY(0);
with ComponentsList do
begin
Height := ScaleY(180);
with SelectDirLabel do
begin
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(417);
Height := ScaleY(115);
end;
end;
end;
with TLabel.Create(WizardForm) do
begin
Parent:=WizardForm;
AutoSize:=False;
Transparent:= true;
SetBounds(ScaleX(20), ScaleY(320), ScaleX(118), ScaleY(35));
end;
end;
end;
function LoadLibraryEx(lpFileName: String; hFile: THandle; dwFlags: DWORD): THandle; external 'LoadLibraryEx{#A}@kernel32.dll stdcall';
function LoadString(hInstance: THandle; uID: SmallInt; var lpBuffer: Char; nBufferMax: Integer): Integer; external 'LoadString{#A}@user32.dll stdcall';
function SHGetNewLinkInfo(pszLinkTo, pszDir: String; var pszName: Char; var pfMustCopy: Longint; uFlags: UINT): BOOL; external 'SHGetNewLinkInfo{#A}@shell32.dll stdcall';
function PinToTaskbar(const szFilename: String; IsPin: Boolean): Boolean;
// szFilename : full path to executable file
// IsPin......: False - unpin from TaskBar, True - pin to TaskBar
var
hInst: THandle;
buf: array [0..255] of Char;
i, res: Integer;
strLnk, strVerb: String;
objShell, colVerbs: Variant;
begin
Result := False;
if (GetWindowsVersion < $06010000) or not FileExists(szFilename) then Exit; { below Windows 7 }
{ String resources }
if IsPin then
begin
if SHGetNewLinkInfo(szFilename, ExpandConstant('{tmp}'), buf[0], res, 0) then
begin
while buf[Length(strLnk)] <> #0 do Insert(buf[Length(strLnk)], strLnk, Length(strLnk)+1);
if FileExists(ExpandConstant('{userappdata}\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\') + ExtractFileName(strLnk)) then Exit;
end;
res := 5386; { Pin to Tas&kbar }
end else res := 5387; { Unpin from Tas&kbar }
{ Load string resource }
hInst := LoadLibraryEx(ExpandConstant('{sys}\shell32.dll'), 0, LOAD_LIBRARY_AS_DATAFILE);
if hInst <> 0 then
try
for i := 0 to LoadString(hInst, res, buf[0], 255)-1 do Insert(buf[i], strVerb, i+1);
try
objShell := CreateOleObject('Shell.Application');
colVerbs := objShell.Namespace(ExtractFileDir(szFilename)).ParseName(ExtractFileName(szFilename)).Verbs;
for i := 1 to colVerbs.Count do if CompareText(colVerbs.Item[i].Name, strVerb) = 0 then
begin
colVerbs.Item[i].DoIt;
Result := True;
Break;
end;
except
Exit;
end;
finally
FreeDLL(hInst);
end;
end;
/////////////////////////////////////////////////////////////////////////
function PinToStartMenu(const szFilename: String; IsPin: Boolean): Boolean;
// szFilename : full path to exe- or lnk-file
// IsPin......: False - unpin from StartMenu, True - pin to StartMenu
var
hInst: THandle;
buf: array [0..259] of Char;
i, res: Integer;
strLnk, strVerb: String;
objShell, colVerbs: Variant;
begin
Result := False;
if not FileExists(szFilename) then Exit;
if GetWindowsVersion > $06020000 then Exit; { Window 8 and above }
{ Windows 7 }
if (GetWindowsVersion >= $06010000) and boolean(SHGetNewLinkInfo(szFilename, ExpandConstant('{tmp}'), buf[0], res, 0)) then
begin
while buf[Length(strLnk)] <> #0 do Insert(buf[Length(strLnk)], strLnk, Length(strLnk)+1);
if FileExists(ExpandConstant('{userappdata}\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu\') + ExtractFileName(strLnk)) then Exit;
end;
{ String resources }
if IsPin then
res := 5381 { Pin to Start Men&u }
else
res := 5382; { Unpin from Start Men&u }
{ Load string resource }
hInst := LoadLibraryEx(ExpandConstant('{sys}\shell32.dll'), 0, LOAD_LIBRARY_AS_DATAFILE);
if hInst <> 0 then
try
for i := 0 to LoadString(hInst, res, buf[0], 255)-1 do Insert(buf[i], strVerb, i+1);
try
objShell := CreateOleObject('Shell.Application');
{ below Windows 7 }
if GetWindowsVersion < $06010000 then
begin
objShell.Namespace(ExtractFileDir(szFilename)).ParseName(ExtractFileName(szFilename)).InvokeVerb(strVerb);
Result := True;
end;
{ Windows 7 }
if GetWindowsVersion >= $06010000 then
begin
colVerbs := objShell.Namespace(ExtractFileDir(szFilename)).ParseName(ExtractFileName(szFilename)).Verbs;
for i := 1 to colVerbs.Count do if CompareText(colVerbs.Item[i].Name, strVerb) = 0 then
begin
colVerbs.Item[i].DoIt;
Result := True;
Break;
end;
end;
except
Exit;
end;
finally
FreeDLL(hInst);
end;
end;
function ParamExists(S: String): Boolean;
var
i: Integer;
begin
Result:= False;
for i:= 0 to ParamCount() do begin
if Pos(Uppercase(S), Uppercase(ParamStr(i))) > 0 then begin
Result:= true;
Break;
end;
end;
end;
function GetCmdDirValue(): String;
var
i: Integer;
begin
Result:= '';
for i:= 0 to ParamCount() do begin
if (Pos('/DIR', Uppercase(ParamStr(i))) > 0) then begin
Result:= Copy(ParamStr(i), 6, Length(ParamStr(i)));
StringChange(Result, 'expand:', '');
StringChange(Result, 'EXPAND:', '');
Result:= ExpandConstant(Result);
Break;;
end;
end;
end;
Procedure CurPageChanged(CurPageID: Integer);
Begin
Case CurPageID of
wpSelectTasks:
if IsComponentSelected('AIMP\I') then
begin
WizardForm.NextButton.Caption:= SetupMessage(msgButtonInstall);
end;
wpSelectDir: if WizardForm.Tag = 1 then
begin
WizardForm.SelectDirPage.Notebook.ActivePage:= WizardForm.SelectComponentsPage;
WizardForm.PageNameLabel.Caption:= SetupMessage(msgWizardSelectComponents);
WizardForm.Hint:= WizardForm.PageDescriptionLabel.Caption; // запомнить SetupMessage(msgSelectDirDesc)
WizardForm.PageDescriptionLabel.Caption:= SetupMessage(msgSelectComponentsDesc);
end;
wpSelectComponents: if WizardForm.Tag = 1 then
begin
WizardForm.SelectComponentsPage.Notebook.ActivePage:= WizardForm.SelectDirPage;
WizardForm.DiskSpaceLabel.Caption:= WizardForm.ComponentsDiskSpaceLabel.Caption;
WizardForm.PageNameLabel.Caption:= SetupMessage(msgWizardSelectDir);
WizardForm.PageDescriptionLabel.Caption:= WizardForm.Hint; // иначе вместо названия программы [name]
if (not ParamExists('/dir')) then begin
if IsComponentSelected('AIMP\I') then
WizardForm.DirEdit.Text := (ExpandConstant('{#SetupSetting("DefaultDirName")}'))
else if IsComponentSelected('AIMP\P') then begin
WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + '{#MyAppName} Portable'
WizardForm.NextButton.Caption:= CustomMessage('ButtonPortable');
end;
end else
WizardForm.DirEdit.Text := GetCmdDirValue();
end;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
RC: integer;
begin
if CurStep = ssDone then
if IsTaskSelected('ic\taskbar') then
PinToTaskbar(ExpandConstant('{app}\{#Exe}'), True);
if CurStep = ssDone then
if IsTaskSelected('ic\startmenu') then
PinToStartMenu(ExpandConstant('{app}\{#Exe}'), True);
if CurStep = ssDone then
if not WizardSilent then
MsgBox('Всё готово, приятного пользования
', mbInformation, MB_OK);
if CurStep = ssDone then
if NewCheckBox1.Checked then
ShellExec('open','http://repackbypilot.blogspot.com','', '', SW_SHOW, ewNoWait, RC)
end;
procedure DeinitializeSetup();
begin
if iInitialize then
begin
gdipShutdown;
TaskBarDestroy;
end;
end;
procedure InitializeUninstallProgressForm;
begin
with UninstallProgressForm do
begin
///////////////////////////////////Логотип и изображения мастера
if GetFromRes('_IS_BOTVA', 'botva2.dll') and GetFromRes('_IS_B2P', 'b2p.dll') and GetFromRes('_IS_LOGO', 'logo.png') and GetFromRes('_IS_LIPIC', 'LIPic.png') then
begin
///////////////////////////////////Изображения
lPicHandle := ImgLoad(MainPanel.Handle, ExpandConstant('{tmp}\LiPic.png'), WizardSmallBitmapImage.Left, WizardSmallBitmapImage.Top, WizardSmallBitmapImage.Width, WizardSmallBitmapImage.Height, True, True);
WizardSmallBitmapImage.Hide;
ImgSetVisibility(lPicHandle, True);
ImgApplyChanges(MainPanel.Handle);
///////////////////////////////////Логотип
lPLogo:= ImgLoad(UninstallProgressForm.Handle, ExpandConstant('{tmp}\logo.png'), ScaleX(20), ScaleY(320), ScaleX(118), ScaleY(35), True, True);
ImgApplyChanges(UninstallProgressForm.Handle);
end;
with TLabel.Create(nil) do
begin
Parent:=UninstallProgressForm;
AutoSize:=False;
Transparent:= true;
SetBounds(ScaleX(20), ScaleY(320), ScaleX(118), ScaleY(35));
end;
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
instPath: string;
begin
case CurUninstallStep of
usUninstall:
begin
PinToTaskbar(ExpandConstant('{app}\{#Exe}'), False);
PinToStartMenu(ExpandConstant('{app}\{#Exe}'), False);
end;
usPostUninstall:
if DirExists(AddBackslash(ExpandConstant('{userappdata}')) + 'AIMP') then
begin
if MsgBoxEx(0, 'Удалить настройки программы?', 'Удаление настроек', $00000004 or $00000020, 0, 0) = IDYES then
DelTree(AddBackslash(ExpandConstant('{userappdata}')) + 'AIMP', True, True, True);
end;
end;
end;
procedure DeinitializeUninstall();
begin
if iInitialize then gdipShutdown;
end;
[UninstallDelete]
Name: {app}; Type: filesandordirs;
[Messages]
BeveledLabel=RePack by Pilot
InfoBeforeLabel=...
InstallingLabel=...
PreparingDesc=...
SelectComponentsDesc=...
SelectDirDesc=...
SelectTasksDesc=...
UninstallStatusLabel=...
SelectLanguageTitle={#MyAppName}
SelectLanguageLabel=Please select a language.%nВыберите язык установщика.
WizardInfoBefore=Особенности релиза
WizardSelectTasks=Выбор задачь
SelectDirLabel3=Программа установит [name] в следующую папку. Чтобы установить приложение в другую папку, нажмите кнопку 'Обзор' и укажите ее.%n%nПожалуйста, обратите внимание, что во время деинсталляции указанная папка будет удалена вместе со всем её содержимым.%n%nНажмите 'Далее' или 'Распаковать', чтобы продолжить.
SelectTasksLabel2=Выберите дополнительные задачи, которые должны выполниться при установке [name], после этого нажмите 'Установить':
[Ini]
Filename: {app}\AIMP.ini; Section: System; Key: UserMode; String: 0; Components: AIMP\P;
Filename: {app}\AIMP.ini; Section: System; Key: UserMode; String: 1; Components: AIMP\I;
Filename: {app}\AIMP.ini; Section: System; Key: BlockAssociations; String: 1; Components: AIMP\P;
Filename: {app}\AIMP.ini; Section: System; Key: BlockAssociations; String: 0; Components: AIMP\I;
Filename: {app}\AIMP.ini; Section: System; Key: DefaultLang; String: russian.lng; Languages: R;
Filename: {app}\AIMP.ini; Section: System; Key: DefaultLang; String: english.lng; Languages: E;
Filename: {app}\AIMP.ini; Section: System; Key: DefaultLang; String: ukrainian.lng; Languages: U;
Filename: {app}\AIMP.ini; Section: System; Key: Version; String: 4000;
Filename: {app}\Profile\AIMP.ini; Section: System; Key: LangFile; String: russian.lng; Components: AIMP\P; Languages: R;
Filename: {app}\Profile\AIMP.ini; Section: System; Key: LangFile; String: english.lng; Components: AIMP\P; Languages: E;
Filename: {app}\Profile\AIMP.ini; Section: System; Key: LangFile; String: ukrainian.lng; Components: AIMP\P; Languages: U;
Filename: {app}\Profile\AIMP-ContextMenu.ini; Section: Menu; Key: Lang; String: russian.lng; Components: AIMP\P; Languages: R;
Filename: {app}\Profile\AIMP-ContextMenu.ini; Section: Menu; Key: Lang; String: english.lng; Components: AIMP\P; Languages: E;
Filename: {app}\Profile\AIMP-ContextMenu.ini; Section: Menu; Key: Lang; String: ukrainian.lng; Components: AIMP\P; Languages: U;
Filename: {userappdata}\AIMP\AIMP.ini; Section: System; Key: LangFile; String: russian.lng; Components: AIMP\I; Languages: R;
Filename: {userappdata}\AIMP\AIMP.ini; Section: System; Key: LangFile; String: english.lng; Components: AIMP\I; Languages: E;
Filename: {userappdata}\AIMP\AIMP.ini; Section: System; Key: LangFile; String: ukrainian.lng; Components: AIMP\I; Languages: U;
Filename: {userappdata}\AIMP\AIMP-ContextMenu.ini; Section: Menu; Key: Lang; String: russian.lng; Components: AIMP\I; Languages: R;
Filename: {userappdata}\AIMP\AIMP-ContextMenu.ini; Section: Menu; Key: Lang; String: english.lng; Components: AIMP\I; Languages: E;
Filename: {userappdata}\AIMP\AIMP-ContextMenu.ini; Section: Menu; Key: Lang; String: ukrainian.lng; Components: AIMP\I; Languages: U;