1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
|
# This script contains the following functions:
#
# - MissingPrograms, (check if third-party programs are installed), uses:
# EditorCheck
# FileCheck
#
# - MissingProgramsPage,
# (generate the page showing the missing programs that will be installed)
#
# - EditorCheck,
# (test if an editor with syntax-highlighting for LaTeX-files is installed)
#
#--------------------------
Function MissingPrograms
# check if third-party programs are installed
# initialize variable, is later set to True when a program was not found
${if} $MissedProg != "True" # is already True when LaTeX is missing
StrCpy $MissedProg "False"
${endif}
# test if Ghostscript is installed
GSloop:
EnumRegKey $1 HKLM "Software\AFPL Ghostscript" 0
${if} $1 == ""
EnumRegKey $1 HKLM "Software\GPL Ghostscript" 0
${if} $1 != ""
StrCpy $2 "True"
${endif}
${endif}
${if} $1 != ""
${if} $2 == "True"
ReadRegStr $3 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GPL Ghostscript $1" "DisplayName"
StrCpy $0 "Software\GPL Ghostscript\$1"
${else}
ReadRegStr $3 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\AFPL Ghostscript $1" "DisplayName"
StrCpy $0 "Software\AFPL Ghostscript\$1"
${endif}
${if} $3 == "" # if nothing was found in the uninstall section
ReadRegStr $3 HKLM "SOFTWARE\GPL Ghostscript" "OnlyWithLyX" # check if Ghostscript was installed together with LyX
${endif}
${if} $3 == "" # if nothing was found in the uninstall section
DeleteRegKey HKLM "$0"
goto GSloop
${else}
ReadRegStr $GhostscriptPath HKLM $0 "GS_DLL"
${if} $GhostscriptPath != ""
StrCpy $GhostscriptPath "$GhostscriptPath" -12 # remove ending "gsdll32.dll"
${else}
StrCpy $MissedProg "True"
${endif}
${endif} # if $3
${else} # if $1
StrCpy $GhostscriptPath ""
StrCpy $MissedProg "True"
${endif}
# test if Imagemagick is installed
ReadRegStr $ImageMagickPath HKLM "Software\ImageMagick\Current" "BinPath"
${if} $ImageMagickPath == ""
StrCpy $MissedProg "True"
${endif}
# test if Aiksaurus is installed
!insertmacro FileCheck $5 "meanings.dat" "${AiksaurusDir}" # macro from LyXUtils.nsh
${if} $5 == "True"
StrCpy $AiksaurusPath "${AiksaurusDir}"
${endif}
# ReadRegStr $AiksaurusPath HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "AIK_DATA_DIR"
# test if Aspell is installed
StrCpy $5 ""
ReadRegStr $5 HKCU "SOFTWARE\Aspell" "Base Path"
${if} $5 == ""
ReadRegStr $5 HKLM "SOFTWARE\Aspell" "Base Path"
StrCpy $AspellBaseReg "HKLM" # used in the aspell installation section
${else}
StrCpy $AspellBaseReg "HKCU"
${endif}
${if} $5 == ""
StrCpy $MissedProg "True"
${else}
StrCpy $AspellPath "$5"
${endif}
# test if Python is installed
# only use an existing python when it is version 2.5 or newer because some
# older Compaq and Dell PCs were delivered with outdated Python interpreters
# Python 3.x was reported not to work with LyX properly, see
# http://www.lyx.org/trac/ticket/7143
ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.5\InstallPath" ""
${if} $PythonPath == ""
ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.6\InstallPath" ""
${endif}
${if} $PythonPath == ""
ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.7\InstallPath" ""
${endif}
${if} $PythonPath != ""
StrCpy $PythonPath $PythonPath -1 # remove the "\" at the end
StrCpy $DelPythonFiles "True"
${endif}
# test if Acrobat or Adobe Reader is used as PDF-viewer
ReadRegStr $String HKCR ".pdf" ""
${if} $String != "AcroExch.Document" # this name is only used by Acrobat and Adobe Reader
StrCpy $Acrobat "None"
${else}
StrCpy $Acrobat "Yes"
${endif}
# test if a PostScript-viewer is installed, only check for GSview32
StrCpy $PSVPath ""
ReadRegStr $PSVPath HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\gsview32.exe" "Path"
# test if an editor with syntax-highlighting for LaTeX-files is installed
Call EditorCheck
# test if an image editor is installed (due to LyX's bug 2654 first check for GIMP)
StrCpy $ImageEditorPath ""
ReadRegStr $ImageEditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinGimp-2.0_is1" "DisplayIcon"
${if} $ImageEditorPath != ""
StrCpy $ImageEditorPath "$ImageEditorPath" -13 # delete "\gimp-2.x.exe"
${endif}
# check for Photoshop
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\Photoshop.exe" "Path"
${if} $0 != ""
StrCpy $0 "$0" -1 # delete the last "\"
${if} $ImageEditorPath != ""
StrCpy $ImageEditorPath "$ImageEditorPath;$0"
${else}
StrCpy $ImageEditorPath $0
${endif}
${endif}
# test if the BibTeX-editor JabRef is installed
StrCpy $BibTeXEditorPath ""
ReadRegStr $BibTeXEditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef 2.3" "UninstallString"
${if} $BibTeXEditorPath == ""
ReadRegStr $BibTeXEditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef 2.3.1" "UninstallString"
${endif}
${if} $BibTeXEditorPath == ""
ReadRegStr $BibTeXEditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef 2.4" "UninstallString"
${endif}
${if} $BibTeXEditorPath == ""
ReadRegStr $BibTeXEditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef 2.4.1" "UninstallString"
${endif}
${if} $BibTeXEditorPath == ""
ReadRegStr $BibTeXEditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef 2.4.2" "UninstallString"
${endif}
${if} $BibTeXEditorPath == ""
ReadRegStr $BibTeXEditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef 2.5" "UninstallString"
${endif}
${if} $BibTeXEditorPath == ""
ReadRegStr $BibTeXEditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef 2.6" "UninstallString"
${endif}
# test if Inkscape is installed
ReadRegStr $SVGPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Inkscape" "InstallLocation"
# test if metafile2eps is installed
ReadRegStr $WMFPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Metafile to EPS Converter" "InstallLocation"
FunctionEnd
# ---------------------------------------
Function MissingProgramsPage
# generate the page showing the missing programs that will be installed
StrCpy $0 "2" # start value for the dynamical item numbering
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "io_missing_progs.ini"
!insertmacro MUI_HEADER_TEXT "$(MissProgHeader)" ""
${if} $MissedProg == "False"
!insertmacro MUI_INSTALLOPTIONS_WRITE "io_missing_progs.ini" "Field 6" "Text" "$(MissProgMessage)"
${else}
!insertmacro MUI_INSTALLOPTIONS_WRITE "io_missing_progs.ini" "Field 1" "Text" "$(MissProgCap)"
${if} ${INSTALLER_VERSION} == "Complete"
${if} $LatexPath == ""
!insertmacro MUI_INSTALLOPTIONS_WRITE "io_missing_progs.ini" "Field $0" "Text" "$(MissProgLatex)"
IntOp $0 $0 + 1
${endif}
${endif}
${if} $GhostscriptPath == ""
!insertmacro MUI_INSTALLOPTIONS_WRITE "io_missing_progs.ini" "Field $0" "Text" "$(MissProgGhostscript)"
IntOp $0 $0 + 1
${endif}
${if} $ImageMagickPath == ""
!insertmacro MUI_INSTALLOPTIONS_WRITE "io_missing_progs.ini" "Field $0" "Text" "$(MissProgImageMagick)"
IntOp $0 $0 + 1
${endif}
${if} $AspellPath == ""
!insertmacro MUI_INSTALLOPTIONS_WRITE "io_missing_progs.ini" "Field $0" "Text" "$(MissProgAspell)"
${endif}
${endif}
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "io_missing_progs.ini"
FunctionEnd
# ---------------------------------------
Function MissingProgramsPage_LeaveFunction
# this empty function is needed for the installer page
FunctionEnd
# ---------------------------------------
Function EditorCheck
# test if an editor with syntax-highlighting for LaTeX-files is installed
# (check for jEdit, PSPad, WinShell, ConTEXT, Crimson Editor, Vim, TeXnicCenter, LaTeXEditor, WinEdt, LEd, WinTeX)
StrCpy $EditorPath ""
StrCpy $0 ""
# check for jEdit
ReadRegStr $EditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\jEdit_is1" "InstallLocation"
${if} $EditorPath != ""
StrCpy $EditorPath $EditorPath -1 # remove "\" from the end of the string
${endif}
# check for PSPad
StrCpy $0 ""
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PSPad editor_is1" "InstallLocation"
${if} $0 != ""
StrCpy $0 $0 -1
StrCpy $EditorPath "$EditorPath;$0"
${endif}
# check for WinShell
StrCpy $0 ""
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinShell_is1" "InstallLocation"
${if} $0 != ""
StrCpy $0 $0 -1
StrCpy $EditorPath "$EditorPath;$0"
${endif}
# check for ConTEXT
StrCpy $0 ""
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ConTEXTEditor_is1" "InstallLocation"
${if} $0 != ""
StrCpy $0 $0 -1
StrCpy $EditorPath "$EditorPath;$0"
${endif}
# check for Crimson Editor
StrCpy $0 ""
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Crimson Editor" "UninstallString"
${if} $0 != ""
StrCpy $0 $0 -14 # remove "\uninstall.exe"
StrCpy $EditorPath "$EditorPath;$0"
${endif}
# check for Vim 6.x
StrCpy $0 ""
ReadRegStr $0 HKLM "Software\Classes\Applications\gvim.exe\shell\edit\command" ""
${if} $0 != ""
StrCpy $0 $0 -13 # remove "gvim.exe "%1""
StrCpy $EditorPath "$EditorPath;$0"
${endif}
# check for Vim 7.0
StrCpy $0 ""
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Vim 7.0" "UninstallString"
${if} $0 != ""
StrCpy $0 $0 -18 # remove "\uninstall-gui.exe"
StrCpy $EditorPath "$EditorPath;$0"
${endif}
# check for TeXnicCenter
StrCpy $0 ""
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TeXnicCenter_is1" "Inno Setup: App Path"
${if} $0 != ""
StrCpy $EditorPath "$EditorPath;$0"
${endif}
# check for LaTeXEditor
StrCpy $0 ""
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LaTeX Editor" "InstallLocation"
${if} $0 != ""
StrCpy $EditorPath "$EditorPath;$0"
${endif}
# check for WinEdt
StrCpy $0 ""
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinEdt_is1" "InstallLocation"
${if} $0 != ""
StrCpy $0 $0 -1
StrCpy $EditorPath "$EditorPath;$0"
${endif}
# check for LEd
StrCpy $0 ""
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LEd_is1" "InstallLocation"
${if} $0 != ""
StrCpy $0 $0 -1
StrCpy $EditorPath "$EditorPath;$0"
${endif}
# check for WinTeX
StrCpy $0 ""
ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinTeX XP" "DisplayIcon"
${if} $0 != ""
StrCpy $0 $0 -11 # remove "\wintex.exe"
StrCpy $EditorPath "$EditorPath;$0"
${endif}
FunctionEnd
|