5 Detection of external component locations
9 # This script contains the following functions:
11 # - SearchExternal, calls the functions:
16 # - MissingPrograms, (check if third-party programs are installed), uses:
20 # - FindDictionaries (finds installed spellcheck and thesaurus dictionaries)
23 # (test if an editor with syntax-highlighting for LaTeX-files is installed)
25 #--------------------------
27 Function SearchExternal
28 Call LaTeXActions # function from LaTeX.nsh
30 SetRegView ${APP_VERSION_ACHITECHTURE}
31 Call FindDictionaries # function from dictionaries.nsh
34 # ---------------------------------------
36 Function MissingPrograms
37 # check if third-party programs are installed
39 # test if Ghostscript is installed, check all cases:
41 # 2. 64bit Windows but 32bit Ghostscript
42 # 3. 64bit Windows and 64bit Ghostscript
50 EnumRegKey $1 HKLM "Software\GPL Ghostscript" $3
52 ReadRegStr $2 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GPL Ghostscript $1" "DisplayName"
53 StrCpy $0 "Software\GPL Ghostscript\$1"
54 ${if} $2 == "" # if nothing was found in the uninstall section
55 ReadRegStr $2 HKLM "SOFTWARE\GPL Ghostscript" "OnlyWithLyX" # check if Ghostscript was installed together with LyX
57 ${if} $2 == "" # if nothing was found in the uninstall section
58 DeleteRegKey HKLM "$0"
61 ReadRegStr $GhostscriptPath HKLM $0 "GS_DLL"
62 ${if} $GhostscriptPath != ""
63 StrCpy $GhostscriptPath "$GhostscriptPath" -12 # remove ending "gsdll32.dll"
65 # there might be several versions installed and we want to use the newest one
73 ${andif} $GhostscriptPath == ""
75 # we have to assure that we only repeat once and not forever
82 # test if Python is installed
83 # only use an existing python when it is version 2.5 or newer because some
84 # older Compaq and Dell PCs were delivered with outdated Python interpreters
85 # Python 3.x was reported not to work with LyX properly, see
86 # http://www.lyx.org/trac/ticket/7143
87 ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.5\InstallPath" ""
88 ${if} $PythonPath == ""
89 ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.6\InstallPath" ""
91 ${if} $PythonPath == ""
92 ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.7\InstallPath" ""
94 ${if} $PythonPath != ""
95 StrCpy $PythonPath $PythonPath -1 # remove the "\" at the end
96 StrCpy $DelPythonFiles "True"
99 # No test necessary for Acrobat or Adobe Reader because pdfview does this job
100 # each time it is called.
102 # test if a PostScript-viewer is installed, only check for GSview
105 # 2. 64bit Windows but 32bit GSview
106 # 3. 64bit Windows and 64bit GSview
110 ReadRegStr $PSVPath HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\gsview64.exe" "Path"
113 # repeat for case 1. and 2.
115 ReadRegStr $PSVPath HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\gsview32.exe" "Path"
118 # test if an editor with syntax-highlighting for LaTeX-files is installed
121 # test if an image editor is installed
122 StrCpy $ImageEditorPath ""
123 # first check for Gimp which is a 64bit application on x64 Windows
127 ReadRegStr $ImageEditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GIMP-2_is1" "InstallLocation"
128 ${if} $ImageEditorPath != ""
129 StrCpy $ImageEditorPath "$ImageEditorPathbin" # add the bin folder
130 StrCpy $ImageEditor "Gimp"
135 # check for Photoshop
136 ReadRegStr $0 HKLM "Software\Classes\Applications\Photoshop.exe\shell\open\command" ""
138 StrCpy $0 "$0" -20 # delete '\photoshop.exe" "%1"'
139 StrCpy $0 $0 "" 1 # remove the leading quote
140 ${if} $ImageEditorPath != ""
141 StrCpy $ImageEditorPath "$ImageEditorPath;$0"
143 StrCpy $ImageEditorPath $0
145 StrCpy $ImageEditor "Photoshop"
151 ReadRegStr $0 HKLM "SOFTWARE\Classes\Krita.Document\shell\open\command" ""
153 StrCpy $0 "$0" -16 # delete '\krita.exe" "%1"'
154 StrCpy $0 $0 "" 1 # remove the leading quote
155 ${if} $ImageEditorPath != ""
156 StrCpy $ImageEditorPath "$ImageEditorPath;$0"
158 StrCpy $ImageEditorPath $0
160 StrCpy $ImageEditor "Krita"
166 # test if and where the BibTeX-editor JabRef is installed
170 ReadRegStr $PathBibTeXEditor HKLM "SOFTWARE\JabRef" "Path"
171 # if not installed as admin, check for user
172 ${if} $PathBibTeXEditor == ""
173 ReadRegStr $PathBibTeXEditor HKCU "Software\JabRef" "Path"
179 ${ifnot} ${FileExists} "$PathBibTeXEditor\${BIN_BIBTEXEDITOR}"
180 StrCpy $PathBibTeXEditor ""
181 StrCpy $JabRefInstalled == "No"
183 StrCpy $JabRefInstalled == "Yes"
186 # test if and where LilyPond is installed
187 ReadRegStr $LilyPondPath HKLM "Software\LilyPond" "Install_Dir"
188 ${if} $LilyPondPath != ""
189 StrCpy $LilyPondPath "$LilyPondPath\usr\bin" # add "\usr\bin"
192 # test if Inkscape is installed
193 ReadRegStr $SVGPath HKLM "SOFTWARE\Classes\inkscape.svg\DefaultIcon" ""
195 StrCpy $SVGPath $SVGPath "" 1 # remove the leading quote
196 StrCpy $SVGPath $SVGPath -14 # # delete '\inkscape.exe"'
199 # this was used before Inkscape 0.91:
200 ReadRegStr $SVGPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Inkscape" "InstallLocation"
203 # test if Gnumeric is installed
204 ReadRegStr $0 HKLM "Software\Classes\Applications\gnumeric.exe\shell\Open\command" ""
206 StrCpy $0 $0 -18 # remove "gnumeric.exe" "%1""
207 StrCpy $0 $0 "" 1 # remove the leading quote
208 StrCpy $GnumericPath $0
211 # test if Pandoc is installed
212 # HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\John MacFarlane\Pandoc
214 SetRegView 64 # the PATH is in the 64bit registry section
216 # check for the path to the pandoc.exe in Window's PATH variable
218 StrCpy $Search "pandoc"
219 ReadRegStr $String HKCU "Environment" "PATH"
220 !insertmacro PATHCheck $5 "pandoc.exe" # macro from LyXUtils.nsh
221 # if it is not in the user-specific PATH it might be in the global PATH
223 ReadRegStr $String HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
224 !insertmacro PATHCheck $5 "pandoc.exe" # macro from LyXUtils.nsh
228 StrCpy $PandocPath $5
233 # ---------------------------------------
236 # test if an editor with syntax-highlighting for LaTeX-files is installed
238 # (check for jEdit, PSPad, WinShell, ConTEXT, Crimson Editor, Vim, TeXnicCenter, LaTeXEditor, WinEdt, LEd, WinTeX)
239 StrCpy $EditorPath ""
241 # check for jEdit which is a 64bit application on x64 Windows
245 ReadRegStr $EditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\jEdit_is1" "InstallLocation"
246 ${if} $EditorPath != ""
247 StrCpy $EditorPath $EditorPath -1 # remove "\" from the end of the string
253 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PSPad editor_is1" "InstallLocation"
255 StrCpy $0 $0 -1 # remove the "\"
256 StrCpy $EditorPath "$EditorPath;$0"
261 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinShell_is1" "InstallLocation"
263 StrCpy $0 $0 -1 # remove the "\"
264 StrCpy $EditorPath "$EditorPath;$0"
267 # check for Vim which is a 64bit application on x64 Windows
272 ReadRegStr $0 HKLM "Software\Vim\Gvim" "path"
274 StrCpy $0 $0 -9 # remove "\gvim.exe"
275 StrCpy $EditorPath "$EditorPath;$0"
279 # check for TeXnicCenter which can be a 64bit application on x64 Windows
284 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TeXnicCenter_is1" "InstallLocation"
286 StrCpy $0 $0 -1 # remove the "\"
287 StrCpy $EditorPath "$EditorPath;$0"
290 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TeXnicCenter_is1" "InstallLocation"
292 StrCpy $0 $0 -1 # remove the "\"
293 StrCpy $EditorPath "$EditorPath;$0"
300 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinEdt 7" "InstallLocation"
302 StrCpy $EditorPath "$EditorPath;$0"