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 Call FindDictionaries # function from dictionaries.nsh
33 # ---------------------------------------
35 Function MissingPrograms
36 # check if third-party programs are installed
38 # test if Ghostscript is installed, check all cases:
40 # 2. 64bit Windows but 32bit Ghostscript
41 # 3. 64bit Windows and 64bit Ghostscript
49 EnumRegKey $1 HKLM "Software\GPL Ghostscript" $3
51 ReadRegStr $2 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GPL Ghostscript $1" "DisplayName"
52 StrCpy $0 "Software\GPL Ghostscript\$1"
53 ${if} $2 == "" # if nothing was found in the uninstall section
54 ReadRegStr $2 HKLM "SOFTWARE\GPL Ghostscript" "OnlyWithLyX" # check if Ghostscript was installed together with LyX
56 ${if} $2 == "" # if nothing was found in the uninstall section
57 DeleteRegKey HKLM "$0"
60 ReadRegStr $GhostscriptPath HKLM $0 "GS_DLL"
61 ${if} $GhostscriptPath != ""
62 StrCpy $GhostscriptPath "$GhostscriptPath" -12 # remove ending "gsdll32.dll"
64 # there might be several versions installed and we want to use the newest one
72 ${andif} $GhostscriptPath == ""
74 # we have to assure that we only repeat once and not forever
81 # test if Python is installed
82 # only use an existing python when it is version 2.5 or newer because some
83 # older Compaq and Dell PCs were delivered with outdated Python interpreters
84 # Python 3.x was reported not to work with LyX properly, see
85 # http://www.lyx.org/trac/ticket/7143
86 ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.5\InstallPath" ""
87 ${if} $PythonPath == ""
88 ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.6\InstallPath" ""
90 ${if} $PythonPath == ""
91 ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.7\InstallPath" ""
93 ${if} $PythonPath != ""
94 StrCpy $PythonPath $PythonPath -1 # remove the "\" at the end
95 StrCpy $DelPythonFiles "True"
98 # No test necessary for Acrobat or Adobe Reader because pdfview does this job
99 # each time it is called.
101 # test if a PostScript-viewer is installed, only check for GSview
104 # 2. 64bit Windows but 32bit GSview
105 # 3. 64bit Windows and 64bit GSview
109 ReadRegStr $PSVPath HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\gsview64.exe" "Path"
112 # repeat for case 1. and 2.
114 ReadRegStr $PSVPath HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\gsview32.exe" "Path"
117 # test if an editor with syntax-highlighting for LaTeX-files is installed
120 # test if an image editor is installed
121 StrCpy $ImageEditorPath ""
122 # first check for Gimp which is a 64bit application on x64 Windows
126 ReadRegStr $ImageEditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GIMP-2_is1" "InstallLocation"
127 ${if} $ImageEditorPath != ""
128 StrCpy $ImageEditorPath "$ImageEditorPathbin" # add the bin folder
129 StrCpy $ImageEditor "Gimp"
134 # check for Photoshop
135 ReadRegStr $0 HKLM "Software\Classes\Applications\Photoshop.exe\shell\open\command" ""
137 StrCpy $0 "$0" -20 # delete '\photoshop.exe" "%1"'
138 StrCpy $0 $0 "" 1 # remove the leading quote
139 ${if} $ImageEditorPath != ""
140 StrCpy $ImageEditorPath "$ImageEditorPath;$0"
142 StrCpy $ImageEditorPath $0
144 StrCpy $ImageEditor "Photoshop"
147 ReadRegStr $0 HKLM "SOFTWARE\Classes\Krita.Document\shell\open\command" ""
149 StrCpy $0 "$0" -16 # delete '\krita.exe" "%1"'
150 StrCpy $0 $0 "" 1 # remove the leading quote
151 ${if} $ImageEditorPath != ""
152 StrCpy $ImageEditorPath "$ImageEditorPath;$0"
154 StrCpy $ImageEditorPath $0
156 StrCpy $ImageEditor "Krita"
159 # test if and where the BibTeX-editor JabRef is installed
160 ReadRegStr $PathBibTeXEditor HKCU "Software\JabRef" "Path"
161 ${if} $PathBibTeXEditor == ""
162 ReadRegStr $PathBibTeXEditor HKLM "Software\JabRef" "Path"
164 # since JabRef 3.x the pathes are different
165 # there is currently a bug in the Jabref installer that prevents to install it without admin permissions
166 # therefore only check the admin installation
167 ${if} $PathBibTeXEditor == ""
168 ReadRegStr $PathBibTeXEditor HKLM "SOFTWARE\Classes\JabRef\shell\open\command" ""
169 StrCpy $PathBibTeXEditor $PathBibTeXEditor -17 # remove '\JabRef.exe" "%1"'
170 StrCpy $PathBibTeXEditor $PathBibTeXEditor "" 1 # remove the leading quote
173 ${ifnot} ${FileExists} "$PathBibTeXEditor\${BIN_BIBTEXEDITOR}"
174 StrCpy $PathBibTeXEditor ""
175 StrCpy $JabRefInstalled == "No"
177 StrCpy $JabRefInstalled == "Yes"
180 # test if and where LilyPond is installed
181 ReadRegStr $LilyPondPath HKLM "Software\LilyPond" "Install_Dir"
182 ${if} $LilyPondPath != ""
183 StrCpy $LilyPondPath "$LilyPondPath\usr\bin" # add "\usr\bin"
186 # test if Inkscape is installed
187 ReadRegStr $SVGPath HKLM "SOFTWARE\Classes\inkscape.svg\DefaultIcon" ""
189 StrCpy $SVGPath $SVGPath "" 1 # remove the leading quote
190 StrCpy $SVGPath $SVGPath -14 # # delete '\inkscape.exe"'
193 # this was used before Inkscape 0.91:
194 ReadRegStr $SVGPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Inkscape" "InstallLocation"
197 # test if Gnumeric is installed
198 ReadRegStr $0 HKLM "Software\Classes\Applications\gnumeric.exe\shell\Open\command" ""
200 StrCpy $0 $0 -18 # remove "gnumeric.exe" "%1""
201 StrCpy $0 $0 "" 1 # remove the leading quote
202 StrCpy $GnumericPath $0
205 # test if Pandoc is installed
206 # HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\John MacFarlane\Pandoc
208 SetRegView 64 # the PATH is in the 64bit registry section
210 # check for the path to the pandoc.exe in Window's PATH variable
212 StrCpy $Search "pandoc"
213 ReadRegStr $String HKCU "Environment" "PATH"
214 !insertmacro PATHCheck $5 "pandoc.exe" # macro from LyXUtils.nsh
215 # if it is not in the user-specific PATH it might be in the global PATH
217 ReadRegStr $String HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
218 !insertmacro PATHCheck $5 "pandoc.exe" # macro from LyXUtils.nsh
222 StrCpy $PandocPath $5
227 # ---------------------------------------
230 # test if an editor with syntax-highlighting for LaTeX-files is installed
232 # (check for jEdit, PSPad, WinShell, ConTEXT, Crimson Editor, Vim, TeXnicCenter, LaTeXEditor, WinEdt, LEd, WinTeX)
233 StrCpy $EditorPath ""
235 # check for jEdit which is a 64bit application on x64 Windows
239 ReadRegStr $EditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\jEdit_is1" "InstallLocation"
240 ${if} $EditorPath != ""
241 StrCpy $EditorPath $EditorPath -1 # remove "\" from the end of the string
247 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PSPad editor_is1" "InstallLocation"
249 StrCpy $0 $0 -1 # remove the "\"
250 StrCpy $EditorPath "$EditorPath;$0"
255 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinShell_is1" "InstallLocation"
257 StrCpy $0 $0 -1 # remove the "\"
258 StrCpy $EditorPath "$EditorPath;$0"
261 # check for Vim which is a 64bit application on x64 Windows
266 ReadRegStr $0 HKLM "Software\Vim\Gvim" "path"
268 StrCpy $0 $0 -9 # remove "\gvim.exe"
269 StrCpy $EditorPath "$EditorPath;$0"
273 # check for TeXnicCenter which can be a 64bit application on x64 Windows
278 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TeXnicCenter_is1" "InstallLocation"
280 StrCpy $0 $0 -1 # remove the "\"
281 StrCpy $EditorPath "$EditorPath;$0"
284 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TeXnicCenter_is1" "InstallLocation"
286 StrCpy $0 $0 -1 # remove the "\"
287 StrCpy $EditorPath "$EditorPath;$0"
294 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinEdt 7" "InstallLocation"
296 StrCpy $EditorPath "$EditorPath;$0"