5 Detection of external component locations
9 # This script contains the following functions:
11 # - SearchExternal, calls the functions:
15 # - MissingPrograms, (check if third-party programs are installed), uses:
20 # (test if an editor with syntax-highlighting for LaTeX-files is installed)
22 #--------------------------
25 #Var CommandLineOutput
27 Function SearchExternal
28 Call LaTeXActions # function from LaTeX.nsh
32 # ---------------------------------------
34 Function MissingPrograms
35 # check if third-party programs are installed
37 # test if Ghostscript is installed
40 EnumRegKey $1 HKLM "Software\GPL Ghostscript" $3
42 ReadRegStr $2 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GPL Ghostscript $1" "DisplayName"
43 StrCpy $0 "Software\GPL Ghostscript\$1"
44 ${if} $2 == "" # if nothing was found in the uninstall section
45 ReadRegStr $2 HKLM "SOFTWARE\GPL Ghostscript" "OnlyWithLyX" # check if Ghostscript was installed together with LyX
47 ${if} $2 == "" # if nothing was found in the uninstall section
48 DeleteRegKey HKLM "$0"
51 ReadRegStr $GhostscriptPath HKLM $0 "GS_DLL"
52 ${if} $GhostscriptPath != ""
53 StrCpy $GhostscriptPath "$GhostscriptPath" -12 # remove ending "gsdll32.dll"
55 # there might be several versions installed and we want to use the newest one
61 # test if Python is installed
62 # only use an existing python when it is version 2.5 or newer because some
63 # older Compaq and Dell PCs were delivered with outdated Python interpreters
64 # Python 3.x was reported not to work with LyX properly, see
65 # http://www.lyx.org/trac/ticket/7143
66 ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.5\InstallPath" ""
67 ${if} $PythonPath == ""
68 ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.6\InstallPath" ""
70 ${if} $PythonPath == ""
71 ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.7\InstallPath" ""
73 ${if} $PythonPath != ""
74 StrCpy $PythonPath $PythonPath -1 # remove the "\" at the end
75 StrCpy $DelPythonFiles "True"
78 # test if Acrobat or Adobe Reader is used as PDF-viewer
79 ReadRegStr $String HKCR ".pdf" ""
80 ${if} $String != "AcroExch.Document" # this name is only used by Acrobat and Adobe Reader
81 StrCpy $Acrobat "None"
86 # test if a PostScript-viewer is installed, only check for GSview32
88 ReadRegStr $PSVPath HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\gsview32.exe" "Path"
90 # test if an editor with syntax-highlighting for LaTeX-files is installed
93 # test if an image editor is installed
94 StrCpy $ImageEditorPath ""
95 ReadRegStr $ImageEditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinGimp-2.0_is1" "DisplayIcon"
96 ${if} $ImageEditorPath != ""
97 StrCpy $ImageEditorPath "$ImageEditorPath" -13 # delete "\gimp-2.x.exe"
100 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\Photoshop.exe" "Path"
102 StrCpy $0 "$0" -1 # delete the last "\"
103 ${if} $ImageEditorPath != ""
104 StrCpy $ImageEditorPath "$ImageEditorPath;$0"
106 StrCpy $ImageEditorPath $0
110 # test if and where the BibTeX-editor JabRef is installed
111 ReadRegStr $PathBibTeXEditor HKCU "Software\JabRef" "Path"
112 ${if} $PathBibTeXEditor == ""
113 ReadRegStr $PathBibTeXEditor HKLM "Software\JabRef" "Path"
116 ${IfNot} ${FileExists} "$PathBibTeXEditor\${BIN_BIBTEXEDITOR}"
117 StrCpy $PathBibTeXEditor ""
118 StrCpy $JabRefInstalled == "No"
120 StrCpy $JabRefInstalled == "Yes"
123 # test if and where LilyPond is installed
124 ReadRegStr $LilyPondPath HKLM "Software\LilyPond" "Install_Dir"
125 ${if} $LilyPondPath != ""
126 StrCpy $LilyPondPath "$LilyPondPath\usr\bin" # add "\usr\bin"
129 # test if Inkscape is installed
130 ReadRegStr $SVGPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Inkscape" "InstallLocation"
132 # test if metafile2eps is installed
133 ReadRegStr $WMFPath HKLM "Software\Microsoft\Windows NT\CurrentVersion\Print\Printers\Metafile to EPS Converter" "Name"
135 # test if Gnumeric is installed
136 ReadRegStr $0 HKLM "Software\Classes\Applications\gnumeric.exe\shell\Open\command" ""
138 StrCpy $0 $0 -18 # remove "gnumeric.exe" "%1""
139 StrCpy $0 $0 "" 1 # remove the leading quote
140 StrCpy $GnumericPath $0
145 # ---------------------------------------
148 # test if an editor with syntax-highlighting for LaTeX-files is installed
150 # (check for jEdit, PSPad, WinShell, ConTEXT, Crimson Editor, Vim, TeXnicCenter, LaTeXEditor, WinEdt, LEd, WinTeX)
151 StrCpy $EditorPath ""
154 ReadRegStr $EditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\jEdit_is1" "InstallLocation"
155 ${if} $EditorPath != ""
156 StrCpy $EditorPath $EditorPath -1 # remove "\" from the end of the string
160 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PSPad editor_is1" "InstallLocation"
163 StrCpy $EditorPath "$EditorPath;$0"
167 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinShell_is1" "InstallLocation"
170 StrCpy $EditorPath "$EditorPath;$0"
174 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ConTEXTEditor_is1" "InstallLocation"
177 StrCpy $EditorPath "$EditorPath;$0"
179 # check for Crimson Editor
181 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Crimson Editor" "UninstallString"
183 StrCpy $0 $0 -14 # remove "\uninstall.exe"
184 StrCpy $EditorPath "$EditorPath;$0"
188 ReadRegStr $0 HKLM "Software\Classes\Applications\gvim.exe\shell\edit\command" ""
190 StrCpy $0 $0 -13 # remove "gvim.exe "%1""
191 StrCpy $EditorPath "$EditorPath;$0"
195 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Vim 7.0" "UninstallString"
197 StrCpy $0 $0 -18 # remove "\uninstall-gui.exe"
198 StrCpy $EditorPath "$EditorPath;$0"
200 # check for TeXnicCenter
202 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TeXnicCenter_is1" "Inno Setup: App Path"
204 StrCpy $EditorPath "$EditorPath;$0"
206 # check for LaTeXEditor
208 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LaTeX Editor" "InstallLocation"
210 StrCpy $EditorPath "$EditorPath;$0"
214 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinEdt_is1" "InstallLocation"
217 StrCpy $EditorPath "$EditorPath;$0"
221 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LEd_is1" "InstallLocation"
224 StrCpy $EditorPath "$EditorPath;$0"
228 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinTeX XP" "DisplayIcon"
230 StrCpy $0 $0 -11 # remove "\wintex.exe"
231 StrCpy $EditorPath "$EditorPath;$0"