|
| 1 | +; Script generated by the Inno Setup Script Wizard. |
| 2 | +; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! |
| 3 | + |
| 4 | +#define MyAppName "Lively Wallpaper" |
| 5 | +#define MyAppVersion "0.6.5.0" |
| 6 | +#define MyAppPublisher "rocksdanister" |
| 7 | +#define MyAppURL "https://github.com/rocksdanister/lively" |
| 8 | +#define MyAppExeName "livelywpf.exe" |
| 9 | + |
| 10 | +[CustomMessages] |
| 11 | +; This is all machine translated...might be gibberish! |
| 12 | +english.RunAtStartup=Start with Windows |
| 13 | +chinese.RunAtStartup=从Windows开始 |
| 14 | +japanese.RunAtStartup=窓から始める |
| 15 | +russian.RunAtStartup=начать с Windows |
| 16 | +spanish.RunAtStartup=Iniciar Windows |
| 17 | + |
| 18 | +english.FullInstall=Full |
| 19 | +chinese.FullInstall=充分 |
| 20 | +japanese.FullInstall=一杯 |
| 21 | +russian.FullInstall=полный |
| 22 | +spanish.FullInstall=llena |
| 23 | + |
| 24 | +english.LiteInstall=Lite |
| 25 | +chinese.LiteInstall=精简版 |
| 26 | +japanese.LiteInstall=ライト |
| 27 | +russian.LiteInstall=облегченная |
| 28 | +spanish.LiteInstall=lite |
| 29 | + |
| 30 | +english.CustomInstall=Custom |
| 31 | +chinese.CustomInstall=习俗 |
| 32 | +japanese.CustomInstall=カスタム |
| 33 | +russian.CustomInstall=обычай |
| 34 | +spanish.CustomInstall=personalizada |
| 35 | + |
| 36 | +english.DeleteEverythigMsgBox=Do you want to delete userdata & wallpapers in |
| 37 | +chinese.DeleteEverythigMsgBox=您要删除用户数据和墙纸吗 |
| 38 | +japanese.DeleteEverythigMsgBox=ユーザーデータと壁紙を削除しますか |
| 39 | +russian.DeleteEverythigMsgBox=Вы хотите удалить пользовательские данные и обои |
| 40 | +spanish.DeleteEverythigMsgBox=¿Desea eliminar datos de usuario y fondos de pantalla en |
| 41 | + |
| 42 | +[Setup] |
| 43 | +; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. |
| 44 | +; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) |
| 45 | +AppId={{E3E43E1B-DEC8-44BF-84A6-243DBA3F2CB1}} |
| 46 | +AppName={#MyAppName} |
| 47 | +AppVersion={#MyAppVersion} |
| 48 | +;AppVerName={#MyAppName} {#MyAppVersion} |
| 49 | +AppPublisher={#MyAppPublisher} |
| 50 | +AppPublisherURL={#MyAppURL} |
| 51 | +AppSupportURL={#MyAppURL} |
| 52 | +AppUpdatesURL={#MyAppURL} |
| 53 | +DefaultDirName={autopf}\{#MyAppName} |
| 54 | +DisableProgramGroupPage=yes |
| 55 | +; Remove the following line to run in administrative install mode (install for all users.) |
| 56 | +; lowest - AppData folder, admin - Program Files (x86) |
| 57 | +PrivilegesRequired=lowest |
| 58 | +; Ask user which PrivilegesRequired on startup. |
| 59 | +PrivilegesRequiredOverridesAllowed=dialog |
| 60 | +OutputBaseFilename=lively_installer |
| 61 | +SetupIconFile=Icons\icons8-seed-of-life-96-normal.ico |
| 62 | +Compression=lzma |
| 63 | +;Compression=lzma2/ultra64 |
| 64 | +SolidCompression=yes |
| 65 | +WizardStyle=modern |
| 66 | +;Installer/Uninstaller will stop if application is running by checking mutex. |
| 67 | +AppMutex=LIVELY:DESKTOPWALLPAPERSYSTEM |
| 68 | +[Languages] |
| 69 | +Name: "english"; MessagesFile: "compiler:Default.isl"; LicenseFile: "License\License.txt"; |
| 70 | +Name: "chinese"; MessagesFile: "Setup Languages\ChineseSimplified.isl" |
| 71 | +Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl"; |
| 72 | +Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"; |
| 73 | +Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"; |
| 74 | + |
| 75 | +[Tasks] |
| 76 | +Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; |
| 77 | +;GroupDescription: "{cm:AdditionalIcons}" |
| 78 | +Name: "windowsstartup";Description: "{cm:RunAtStartup}" |
| 79 | + |
| 80 | +[Registry] |
| 81 | +;current user only |
| 82 | +Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "livelywpf"; ValueData: "{app}\livelywpf.exe"; Flags: uninsdeletekey; Tasks:windowsstartup |
| 83 | + |
| 84 | +;[UninstallDelete] |
| 85 | + |
| 86 | +[Types] |
| 87 | +Name: "full"; Description: "{cm:FullInstall}" |
| 88 | +Name: "lite"; Description: "{cm:LiteInstall}" |
| 89 | +Name: "custom"; Description: "{cm:CustomInstall}"; Flags: iscustom |
| 90 | + |
| 91 | +[Components] |
| 92 | +Name: "program"; Description: "Program Files"; Types: full lite custom; Flags: fixed |
| 93 | +Name: "cef"; Description: "Web Wallpaper Support"; Types: full |
| 94 | +Name: "wallpapers"; Description: "Sample Wallpapers"; Types: full |
| 95 | + |
| 96 | +[Files] |
| 97 | +Source: "Release\livelywpf.exe"; DestDir: "{app}"; Flags: ignoreversion;Components: program |
| 98 | +Source: "Release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: program |
| 99 | +Source: "Lively Wallpaper\external\cef\*"; DestDir: "{userdocs}\Lively Wallpaper\external\cef"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: cef |
| 100 | +Source: "Lively Wallpaper\wallpapers\*"; DestDir: "{userdocs}\Lively Wallpaper\wallpapers"; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist uninsneveruninstall; Components: wallpapers |
| 101 | +; NOTE: Don't use "Flags: ignoreversion" on any shared system files |
| 102 | + |
| 103 | +[Icons] |
| 104 | +Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" |
| 105 | +Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon |
| 106 | + |
| 107 | +[Code] |
| 108 | +// event fired when the uninstall step is changed: https://stackoverflow.com/revisions/12645836/1 |
| 109 | +procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); |
| 110 | +begin |
| 111 | + // if we reached the post uninstall step (uninstall succeeded), then... |
| 112 | + if CurUninstallStep = usPostUninstall then |
| 113 | + begin |
| 114 | + // query user to confirm deletion; if user chose "Yes", then... |
| 115 | + if SuppressibleMsgBox(ExpandConstant('{cm:DeleteEverythigMsgBox}')+' '+ ExpandConstant('{userdocs}\Lively Wallpaper') + ' ?', |
| 116 | + mbConfirmation, MB_YESNO, IDNO) = IDYES |
| 117 | + then |
| 118 | + // deletion confirmed by user. |
| 119 | + begin |
| 120 | + // Delete the directory Documents/LivelyWallpaper and everything inside it |
| 121 | + DelTree(ExpandConstant('{userdocs}\Lively Wallpaper'), True, True, True); |
| 122 | + end; |
| 123 | + end; |
| 124 | +end; |
| 125 | +
|
| 126 | +[Run] |
| 127 | +Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall |
| 128 | +;skipifsilent |
| 129 | + |
| 130 | +[Code] |
| 131 | +
|
| 132 | +//Uninstall previous install: https://stackoverflow.com/questions/2000296/inno-setup-how-to-automatically-uninstall-previous-installed-version |
| 133 | +//note: Inno does not delete files, it just overwrites & keeps the old ones if they have different name..it can get accumulated/confusing when program structure change?! |
| 134 | +function GetUninstallString(): String; |
| 135 | +var |
| 136 | + sUnInstPath: String; |
| 137 | + sUnInstallString: String; |
| 138 | +begin |
| 139 | + sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1'); |
| 140 | + sUnInstallString := ''; |
| 141 | + if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then |
| 142 | + RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString); |
| 143 | + Result := sUnInstallString; |
| 144 | +end; |
| 145 | +
|
| 146 | +
|
| 147 | +///////////////////////////////////////////////////////////////////// |
| 148 | +function IsUpgrade(): Boolean; |
| 149 | +begin |
| 150 | + Result := (GetUninstallString() <> ''); |
| 151 | +end; |
| 152 | +
|
| 153 | +
|
| 154 | +///////////////////////////////////////////////////////////////////// |
| 155 | +function UnInstallOldVersion(): Integer; |
| 156 | +var |
| 157 | + sUnInstallString: String; |
| 158 | + iResultCode: Integer; |
| 159 | +begin |
| 160 | +// Return Values: |
| 161 | +// 1 - uninstall string is empty |
| 162 | +// 2 - error executing the UnInstallString |
| 163 | +// 3 - successfully executed the UnInstallString |
| 164 | +
|
| 165 | + // default return value |
| 166 | + Result := 0; |
| 167 | +
|
| 168 | + // get the uninstall string of the old app |
| 169 | + sUnInstallString := GetUninstallString(); |
| 170 | + if sUnInstallString <> '' then begin |
| 171 | + sUnInstallString := RemoveQuotes(sUnInstallString); |
| 172 | + if Exec(sUnInstallString, '/VERYSILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then |
| 173 | + Result := 3 |
| 174 | + else |
| 175 | + Result := 2; |
| 176 | + end else |
| 177 | + Result := 1; |
| 178 | +end; |
| 179 | +
|
| 180 | +///////////////////////////////////////////////////////////////////// |
| 181 | +procedure CurStepChanged(CurStep: TSetupStep); |
| 182 | +begin |
| 183 | + if (CurStep=ssInstall) then |
| 184 | + begin |
| 185 | + if (IsUpgrade()) then |
| 186 | + begin |
| 187 | + UnInstallOldVersion(); |
| 188 | + end; |
| 189 | + end; |
| 190 | +end; |
| 191 | +
|
0 commit comments