# -*- coding: utf-8 -*-
from setuphelpers import *
# Installation procedure:
# https://kb.foxit.com/hc/sections/360013522472-Command-Line
# https://kb.foxit.com/hc/articles/360042235352-Foxit-PDF-Reader-MSI-Installer-Public-Properties-
# https://kb.foxit.com/hc/articles/360042663971-Foxit-PDF-Reader-EXE-Installer-Public-Properties-
# old_silentflags = '/ForceInstall /VERYSILENT DESKTOP_SHORTCUT="0" MAKEDEFAULT="0" VIEWINBROWSER="0" LAUNCHCHECKDEFAULT="0" AUTO_UPDATE="0" /passive /norestart /LANG=%s' % lang,
# old_msi_properties = {
# # "ADDLOCAL": '"FX_PDFVIEWER"', # ,FX_PDFA,FX_OCR
# # "ADDLOCAL": "ALL",
# # "INSTALLLOCATION": r'"C:\Program Files (x86)\Foxit Software\Foxit PDF Reader"',
# "MAKEDEFAULT": "0",
# "VIEW_IN_BROWSER": "0",
# "DESKTOP_SHORTCUT": "1",
# "STARTMENU_SHORTCUT": "1",
# "LAUNCHCHECKDEFAULT": "0",
# "AUTO_UPDATE": "0",
# "REMOVENEWVERSION": "1", # Forces an installation to overwrite the higher version of Foxit Reader with the value of "1".
# "REMOVEGAREADER": "1", # Forces to uninstall Foxit Reader (Desktop Version).
# "CPDF_DISABLE": "1",
# "NOTINSTALLUPDATE": "1",
# "INTERNET_DISABLE": "1",
# "DISABLE_UNINSTALL_SURVEY": "1",
# # "KEYCODE": "",
# # "KEYPATH": "",
# "EMBEDDED_PDF_INOFFICE": "0",
# }
# # app_dir = makepath(programfiles32, "Foxit Software") # "Foxit PDF Reader" is added by the installer!
# # properties.update({"INSTALLLOCATION": '"%s"' % app_dir})
def install():
bin_name = glob.glob("FoxitPDFReader*.exe")[0]
# Removing old_app_dir
old_app_dir = makepath(programfiles32, "Foxit Software", "Foxit Reader")
if isdir(old_app_dir):
remove_tree(old_app_dir)
if iswin64():
old_app_dir = makepath(programfiles, "Foxit Software")
if isdir(old_app_dir):
remove_tree(old_app_dir)
# Installing the package
install_exe_if_needed(
bin_name,
silentflags="/VERYSILENT /SUPPRESSMSGBOXES /NORESTART",
timeout=900,
key="Foxit Reader_is1",
min_version=control.get_software_version(),
)
# Disabling updater service
try:
set_service_start_mode("FoxitReaderUpdateService", "Disabled")
except:
pass
def session_setup():
# Cleaning incorrect reg values
for older_version in ["10.0", "10.1", "11.0", "11.1", "11.2", "12.0", "12.1"]:
if reg_key_exists(HKEY_CURRENT_USER, r"SOFTWARE\Foxit Software\Foxit Reader %s" % older_version):
registry_deletekey(HKEY_CURRENT_USER, r"SOFTWARE\Foxit Software", "Foxit Reader %s" % older_version)
# Disabling update-check
print("Disabling: auto-update-check, updater, registration dialog, internet in the app, telemetry, advertisement and promotion")
user_reg_app_path = r"SOFTWARE\Foxit Software\Foxit PDF Reader\Continuous"
registry_setstring(HKEY_CURRENT_USER, r"%s\plugins\Updater" % user_reg_app_path, "UpdateMode", "0")
registry_setstring(HKEY_CURRENT_USER, r"%s\Preferences\Registration" % user_reg_app_path, "bShowRegisterDlg", "0")
# registry_setstring(HKEY_CURRENT_USER, r"%s\Preferences\General" % user_reg_app_path, "bShowStartPage", "0")
registry_setstring(HKEY_CURRENT_USER, r"%s\Preferences\General" % user_reg_app_path, "bShowFloatingPromotionPage", "0")
registry_setstring(HKEY_CURRENT_USER, r"%s\Preferences\General" % user_reg_app_path, "bShowAdvertisement", "0")
registry_setstring(HKEY_CURRENT_USER, r"%s\Preferences\General" % user_reg_app_path, "bDisableInternet", "1")
registry_setstring(HKEY_CURRENT_USER, r"%s\Preferences\General" % user_reg_app_path, "bCollectData", "0")
# Disable plugins # LoadBehavior avoiding them to be loaded automatically # DefaultEnable hide plugins
# registry_set(HKEY_CURRENT_USER, r"%s\plugins\Installed\FoxitInnerPluginBrowser" % user_reg_app_path, "DefaultEnable", 0)
registry_set(HKEY_CURRENT_USER, r"%s\plugins\Installed\FoxitInnerPluginBrowser" % user_reg_app_path, "LoadBehavior", 2)
registry_set(HKEY_CURRENT_USER, r"%s\plugins\Installed\FoxitInnerPluginDropboxPlugin" % user_reg_app_path, "LoadBehavior", 2)
registry_set(HKEY_CURRENT_USER, r"%s\plugins\Installed\FoxitInnerPluginFoxitAccountManagement" % user_reg_app_path, "LoadBehavior", 2)
registry_set(HKEY_CURRENT_USER, r"%s\plugins\Installed\FoxitInnerPluginFoxitUpdater" % user_reg_app_path, "DefaultEnable", 0)
registry_set(HKEY_CURRENT_USER, r"%s\plugins\Installed\FoxitInnerPluginFoxitUpdater" % user_reg_app_path, "LoadBehavior", 2)
registry_set(HKEY_CURRENT_USER, r"%s\plugins\Installed\FoxitInnerPluginGoogleDrive" % user_reg_app_path, "LoadBehavior", 2)
registry_set(HKEY_CURRENT_USER, r"%s\plugins\Installed\FoxitInnerPluginOneDrive" % user_reg_app_path, "LoadBehavior", 2)
registry_set(HKEY_CURRENT_USER, r"%s\plugins\Installed\FoxitInnerPluginOneDriveForBusiness" % user_reg_app_path, "LoadBehavior", 2)
# Zoom 100% by default
registry_setstring(HKEY_CURRENT_USER, r"%s\Preferences\Display" % user_reg_app_path, "nZoomToMode", "1")
# Removing FoxitPDFReaderUpdater
updater_path = makepath(user_appdata, "Foxit Software", "Addon", "Foxit PDF Reader", "FoxitPDFReaderUpdater.exe")
if isfile(updater_path):
killalltasks("FoxitPDFReaderUpdater.exe")
remove_file(updater_path)