1 # This script contains the following functions:
3 # - MissingPrograms, (check if third-party programs are installed), uses:
7 # - MissingProgramsPage,
8 # (generate the page showing the missing programs that will be installed)
11 # (test if an editor with syntax-highlighting for LaTeX-files is installed)
13 #--------------------------
15 Function MissingPrograms
16 # check if third-party programs are installed
18 # initialize variable, is later set to True when a program was not found
19 ${if} $MissedProg != "True" # is already True when LaTeX is missing
20 StrCpy $MissedProg "False"
23 # test if Ghostscript is installed
25 EnumRegKey $1 HKLM "Software\AFPL Ghostscript" 0
27 EnumRegKey $1 HKLM "Software\GPL Ghostscript" 0
34 ReadRegStr $3 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GPL Ghostscript $1" "DisplayName"
35 StrCpy $0 "Software\GPL Ghostscript\$1"
37 ReadRegStr $3 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\AFPL Ghostscript $1" "DisplayName"
38 StrCpy $0 "Software\AFPL Ghostscript\$1"
40 ${if} $3 == "" # if nothing was found in the uninstall section
41 ReadRegStr $3 HKLM "SOFTWARE\GPL Ghostscript" "OnlyWithLyX" # check if Ghostscript was installed together with LyX
43 ${if} $3 == "" # if nothing was found in the uninstall section
44 DeleteRegKey HKLM "$0"
47 ReadRegStr $GhostscriptPath HKLM $0 "GS_DLL"
48 ${if} $GhostscriptPath != ""
49 StrCpy $GhostscriptPath "$GhostscriptPath" -12 # remove ending "gsdll32.dll"
51 StrCpy $MissedProg "True"
55 StrCpy $GhostscriptPath ""
56 StrCpy $MissedProg "True"
59 # test if Imagemagick is installed
60 ReadRegStr $ImageMagickPath HKLM "Software\ImageMagick\Current" "BinPath"
61 ${if} $ImageMagickPath == ""
62 StrCpy $MissedProg "True"
65 # test if Aiksaurus is installed
66 !insertmacro FileCheck $5 "meanings.dat" "${AiksaurusDir}" # macro from LyXUtils.nsh
68 StrCpy $AiksaurusPath "${AiksaurusDir}"
70 # ReadRegStr $AiksaurusPath HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "AIK_DATA_DIR"
72 # test if Aspell is installed
74 ReadRegStr $5 HKCU "SOFTWARE\Aspell" "Base Path"
76 ReadRegStr $5 HKLM "SOFTWARE\Aspell" "Base Path"
77 StrCpy $AspellBaseReg "HKLM" # used in the aspell installation section
79 StrCpy $AspellBaseReg "HKCU"
82 StrCpy $MissedProg "True"
84 StrCpy $AspellPath "$5"
87 # test if Python is installed
88 # only use an existing python when it is version 2.5 because many Compaq and Dell PC are delivered
89 # with outdated Python interpreters
90 ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.5\InstallPath" ""
91 ${if} $PythonPath != ""
92 StrCpy $PythonPath $PythonPath -1 # remove the "\" at the end
93 StrCpy $DelPythonFiles "True"
96 # test if Acrobat or Adobe Reader is used as PDF-viewer
97 ReadRegStr $String HKCR ".pdf" ""
98 ${if} $String != "AcroExch.Document" # this name is only used by Acrobat and Adobe Reader
99 StrCpy $Acrobat "None"
101 StrCpy $Acrobat "Yes"
104 # test if a PostScript-viewer is installed, only check for GSview32
106 ReadRegStr $PSVPath HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\gsview32.exe" "Path"
108 # test if an editor with syntax-highlighting for LaTeX-files is installed
111 # test if an image editor is installed (due to LyX's bug 2654 first check for GIMP)
112 StrCpy $ImageEditorPath ""
113 ReadRegStr $ImageEditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinGimp-2.0_is1" "DisplayIcon"
114 ${if} $ImageEditorPath != ""
115 StrCpy $ImageEditorPath "$ImageEditorPath" -13 # delete "\gimp-2.x.exe"
117 # check for Photoshop
118 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\Photoshop.exe" "Path"
120 StrCpy $0 "$0" -1 # delete the last "\"
121 ${if} $ImageEditorPath != ""
122 StrCpy $ImageEditorPath "$ImageEditorPath;$0"
124 StrCpy $ImageEditorPath $0
128 # test if the BibTeX-editor JabRef is installed
129 StrCpy $BibTeXEditorPath ""
130 ReadRegStr $BibTeXEditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef 2.1" "UninstallString"
131 ${if} $BibTeXEditorPath == ""
132 ReadRegStr $BibTeXEditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef 2.2" "UninstallString"
135 # test if Inkscape is installed
136 ReadRegStr $SVGPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Inkscape" "InstallLocation"
140 # ---------------------------------------
142 Function MissingProgramsPage
143 # generate the page showing the missing programs that will be installed
145 StrCpy $0 "2" # start value for the dynamical item numbering
146 !insertmacro MUI_INSTALLOPTIONS_EXTRACT "io_missing_progs.ini"
147 !insertmacro MUI_HEADER_TEXT "$(MissProgHeader)" ""
149 ${if} $MissedProg == "False"
150 !insertmacro MUI_INSTALLOPTIONS_WRITE "io_missing_progs.ini" "Field 6" "Text" "$(MissProgMessage)"
152 !insertmacro MUI_INSTALLOPTIONS_WRITE "io_missing_progs.ini" "Field 1" "Text" "$(MissProgCap)"
153 ${if} ${INSTALLER_VERSION} == "Complete"
154 ${if} $LatexPath == ""
155 !insertmacro MUI_INSTALLOPTIONS_WRITE "io_missing_progs.ini" "Field $0" "Text" "$(MissProgLatex)"
159 ${if} $GhostscriptPath == ""
160 !insertmacro MUI_INSTALLOPTIONS_WRITE "io_missing_progs.ini" "Field $0" "Text" "$(MissProgGhostscript)"
163 ${if} $ImageMagickPath == ""
164 !insertmacro MUI_INSTALLOPTIONS_WRITE "io_missing_progs.ini" "Field $0" "Text" "$(MissProgImageMagick)"
167 ${if} $AspellPath == ""
168 !insertmacro MUI_INSTALLOPTIONS_WRITE "io_missing_progs.ini" "Field $0" "Text" "$(MissProgAspell)"
172 !insertmacro MUI_INSTALLOPTIONS_DISPLAY "io_missing_progs.ini"
176 # ---------------------------------------
178 Function MissingProgramsPage_LeaveFunction
180 # this empty function is needed for the installer page
184 # ---------------------------------------
187 # test if an editor with syntax-highlighting for LaTeX-files is installed
189 # (check for jEdit, PSPad, WinShell, ConTEXT, Crimson Editor, Vim, TeXnicCenter, LaTeXEditor, WinEdt, LEd, WinTeX)
190 StrCpy $EditorPath ""
193 ReadRegStr $EditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\jEdit_is1" "InstallLocation"
194 ${if} $EditorPath != ""
195 StrCpy $EditorPath $EditorPath -1 # remove "\" from the end of the string
199 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PSPad editor_is1" "InstallLocation"
202 StrCpy $EditorPath "$EditorPath;$0"
206 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinShell_is1" "InstallLocation"
209 StrCpy $EditorPath "$EditorPath;$0"
213 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ConTEXTEditor_is1" "InstallLocation"
216 StrCpy $EditorPath "$EditorPath;$0"
218 # check for Crimson Editor
220 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Crimson Editor" "UninstallString"
222 StrCpy $0 $0 -14 # remove "\uninstall.exe"
223 StrCpy $EditorPath "$EditorPath;$0"
227 ReadRegStr $0 HKLM "Software\Classes\Applications\gvim.exe\shell\edit\command" ""
229 StrCpy $0 $0 -13 # remove "gvim.exe "%1""
230 StrCpy $EditorPath "$EditorPath;$0"
234 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Vim 7.0" "UninstallString"
236 StrCpy $0 $0 -18 # remove "\uninstall-gui.exe"
237 StrCpy $EditorPath "$EditorPath;$0"
239 # check for TeXnicCenter
241 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TeXnicCenter_is1" "Inno Setup: App Path"
243 StrCpy $EditorPath "$EditorPath;$0"
245 # check for LaTeXEditor
247 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LaTeX Editor" "InstallLocation"
249 StrCpy $EditorPath "$EditorPath;$0"
253 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinEdt_is1" "InstallLocation"
256 StrCpy $EditorPath "$EditorPath;$0"
260 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LEd_is1" "InstallLocation"
263 StrCpy $EditorPath "$EditorPath;$0"
267 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinTeX XP" "DisplayIcon"
269 StrCpy $0 $0 -11 # remove "\wintex.exe"
270 StrCpy $EditorPath "$EditorPath;$0"