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"
150 ReadRegStr $0 HKLM "SOFTWARE\Classes\Krita.Document\shell\open\command" ""
152 StrCpy $0 "$0" -16 # delete '\krita.exe" "%1"'
153 StrCpy $0 $0 "" 1 # remove the leading quote
154 ${if} $ImageEditorPath != ""
155 StrCpy $ImageEditorPath "$ImageEditorPath;$0"
157 StrCpy $ImageEditorPath $0
159 StrCpy $ImageEditor "Krita"
165 # test if and where the BibTeX-editor JabRef is installed
169 ReadRegStr $PathBibTeXEditor HKLM "SOFTWARE\JabRef" "Path"
170 # if not installed as admin, check for user
171 ${if} $PathBibTeXEditor == ""
172 ReadRegStr $PathBibTeXEditor HKCU "Software\JabRef" "Path"
178 ${ifnot} ${FileExists} "$PathBibTeXEditor\${BIN_BIBTEXEDITOR}"
179 StrCpy $PathBibTeXEditor ""
180 StrCpy $JabRefInstalled == "No"
182 StrCpy $JabRefInstalled == "Yes"
185 # test if and where LilyPond is installed
186 ReadRegStr $LilyPondPath HKLM "Software\LilyPond" "Install_Dir"
187 ${if} $LilyPondPath != ""
188 StrCpy $LilyPondPath "$LilyPondPath\usr\bin" # add "\usr\bin"
191 # test if Inkscape is installed
192 ReadRegStr $SVGPath HKLM "SOFTWARE\Classes\inkscape.svg\DefaultIcon" ""
194 StrCpy $SVGPath $SVGPath "" 1 # remove the leading quote
195 StrCpy $SVGPath $SVGPath -14 # # delete '\inkscape.exe"'
198 # this was used before Inkscape 0.91:
199 ReadRegStr $SVGPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Inkscape" "InstallLocation"
202 # test if Gnumeric is installed
203 ReadRegStr $0 HKLM "Software\Classes\Applications\gnumeric.exe\shell\Open\command" ""
205 StrCpy $0 $0 -18 # remove "gnumeric.exe" "%1""
206 StrCpy $0 $0 "" 1 # remove the leading quote
207 StrCpy $GnumericPath $0
210 # test if Pandoc is installed
211 # HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\John MacFarlane\Pandoc
213 SetRegView 64 # the PATH is in the 64bit registry section
215 # check for the path to the pandoc.exe in Window's PATH variable
217 StrCpy $Search "pandoc"
218 ReadRegStr $String HKCU "Environment" "PATH"
219 !insertmacro PATHCheck $5 "pandoc.exe" # macro from LyXUtils.nsh
220 # if it is not in the user-specific PATH it might be in the global PATH
222 ReadRegStr $String HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
223 !insertmacro PATHCheck $5 "pandoc.exe" # macro from LyXUtils.nsh
227 StrCpy $PandocPath $5
232 # ---------------------------------------
235 # test if an editor with syntax-highlighting for LaTeX-files is installed
237 # (check for jEdit, PSPad, WinShell, ConTEXT, Crimson Editor, Vim, TeXnicCenter, LaTeXEditor, WinEdt, LEd, WinTeX)
238 StrCpy $EditorPath ""
240 # check for jEdit which is a 64bit application on x64 Windows
244 ReadRegStr $EditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\jEdit_is1" "InstallLocation"
245 ${if} $EditorPath != ""
246 StrCpy $EditorPath $EditorPath -1 # remove "\" from the end of the string
252 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PSPad editor_is1" "InstallLocation"
254 StrCpy $0 $0 -1 # remove the "\"
255 StrCpy $EditorPath "$EditorPath;$0"
260 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinShell_is1" "InstallLocation"
262 StrCpy $0 $0 -1 # remove the "\"
263 StrCpy $EditorPath "$EditorPath;$0"
266 # check for Vim which is a 64bit application on x64 Windows
271 ReadRegStr $0 HKLM "Software\Vim\Gvim" "path"
273 StrCpy $0 $0 -9 # remove "\gvim.exe"
274 StrCpy $EditorPath "$EditorPath;$0"
278 # check for TeXnicCenter which can be a 64bit application on x64 Windows
283 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TeXnicCenter_is1" "InstallLocation"
285 StrCpy $0 $0 -1 # remove the "\"
286 StrCpy $EditorPath "$EditorPath;$0"
289 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TeXnicCenter_is1" "InstallLocation"
291 StrCpy $0 $0 -1 # remove the "\"
292 StrCpy $EditorPath "$EditorPath;$0"
299 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinEdt 7" "InstallLocation"
301 StrCpy $EditorPath "$EditorPath;$0"