;-------------------------------- ; FileBot NSIS installer script ;-------------------------------- !define PRODUCT_PROPER_NAME "FileBot" !define INSTALLER_EXE_NAME "FileBot-setup.exe" !define OPTION_USE_MUI_2 ;-------------------------------- ; Installer Configuration ;-------------------------------- ; Request admin privileges for Windows Vista, 7. RequestExecutionLevel admin ; Name (shown in various places in the installer UI) Name "${PRODUCT_PROPER_NAME}" ; Output file generated by NSIS compiler OutFile "${INSTALLER_EXE_NAME}" ; Use lzma compression SetCompressor lzma ; Optimize Data Block SetDatablockOptimize on ; Restore last write datestamp of files ; SetDateSave on ; Show installation details ShowInstDetails show ShowUnInstDetails show ;-------------------------------- ; Includes ;-------------------------------- !include "MUI2.nsh" !include "x64.nsh" ;-------------------------------- ; Modern UI Configuration ;-------------------------------- ; MUI Settings !define MUI_ABORTWARNING ; MUI Settings / Icons !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico" !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico" ; MUI Settings / Header !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_RIGHT !define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-r.bmp" !define MUI_HEADERIMAGE_UNBITMAP "${NSISDIR}\Contrib\Graphics\Header\orange-uninstall-r.bmp" ; MUI Settings / Wizard !define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange.bmp" !define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\orange-uninstall.bmp" ;-------------------------------- ; Installer pages ;-------------------------------- ; Welcome page !insertmacro MUI_PAGE_WELCOME ; End user license agreement !insertmacro MUI_PAGE_LICENSE "FileBot_EULA.txt" ; Perform installation !insertmacro MUI_PAGE_INSTFILES ; Finish page !insertmacro MUI_PAGE_FINISH ;-------------------------------- ; Language support ;-------------------------------- !insertmacro MUI_LANGUAGE "English" LangString Section_Name_MainProduct ${LANG_ENGLISH} "${PRODUCT_PROPER_NAME}" ;--------------------------- ; Install sections ;--------------------------- Var MSI_STATUS Section MAIN DetailPrint "Uninstalling previous versions..." nsExec::Exec `start "wmic" /b cmd.exe /c wmic.exe product where name="FileBot" call uninstall` DetailPrint "Downloading latest version..." ${if} ${RunningX64} inetc::get /USERAGENT "nsis" /caption "Downloading FileBot (64-bit)" "https://app.filebot.net/download.php?type=msi&arch=x64" "$PLUGINSDIR\FileBot.msi" /end ${else} inetc::get /USERAGENT "nsis" /caption "Downloading FileBot (32-bit)" "https://app.filebot.net/download.php?type=msi&arch=x86" "$PLUGINSDIR\FileBot.msi" /end ${endif} DetailPrint "Installing latest version..." nsExec::Exec `msiexec.exe /passive /norestart /i "$PLUGINSDIR\FileBot.msi"` Pop $MSI_STATUS # grab return value ${if} $MSI_STATUS == "0" DetailPrint "Optimizing..." nsExec::ExecToLog `"C:\Program Files\FileBot\filebot.exe" -script "g:println net.filebot.Settings.getApplicationIdentifier(); println 'JRE: ' + Settings.getJavaRuntimeIdentifier(); println String.format('JVM: %d-bit %s', com.sun.jna.Platform.is64Bit() ? 64 : 32, System.getProperty('java.vm.name')); java.util.prefs.Preferences.userRoot(); net.filebot.CacheManager.getInstance().clearAll(); net.filebot.media.MediaDetection.warmupCachedResources();" --log OFF` DetailPrint "Done. Before you get started, please have a look at the FAQ." ExecShell open `https://app.filebot.net/getting-started/index.html` ExecShell open `https://app.filebot.net/manual.html` ${else} DetailPrint "msiexec error $MSI_STATUS" DetailPrint "Installation failed. Please download the .msi package manually." ExecShell open `https://app.filebot.net/download.php` Abort ${endif} SectionEnd