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 #--------------------------
28 #Var CommandLineOutput
30 Function SearchExternal
31 Call LaTeXActions # function from LaTeX.nsh
36 # ---------------------------------------
38 Function MissingPrograms
39 # check if third-party programs are installed
41 # test if Ghostscript is installed
44 EnumRegKey $1 HKLM "Software\GPL Ghostscript" $3
46 ReadRegStr $2 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GPL Ghostscript $1" "DisplayName"
47 StrCpy $0 "Software\GPL Ghostscript\$1"
48 ${if} $2 == "" # if nothing was found in the uninstall section
49 ReadRegStr $2 HKLM "SOFTWARE\GPL Ghostscript" "OnlyWithLyX" # check if Ghostscript was installed together with LyX
51 ${if} $2 == "" # if nothing was found in the uninstall section
52 DeleteRegKey HKLM "$0"
55 ReadRegStr $GhostscriptPath HKLM $0 "GS_DLL"
56 ${if} $GhostscriptPath != ""
57 StrCpy $GhostscriptPath "$GhostscriptPath" -12 # remove ending "gsdll32.dll"
59 # there might be several versions installed and we want to use the newest one
65 # test if Python is installed
66 # only use an existing python when it is version 2.5 or newer because some
67 # older Compaq and Dell PCs were delivered with outdated Python interpreters
68 # Python 3.x was reported not to work with LyX properly, see
69 # http://www.lyx.org/trac/ticket/7143
70 ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.5\InstallPath" ""
71 ${if} $PythonPath == ""
72 ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.6\InstallPath" ""
74 ${if} $PythonPath == ""
75 ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.7\InstallPath" ""
77 ${if} $PythonPath != ""
78 StrCpy $PythonPath $PythonPath -1 # remove the "\" at the end
79 StrCpy $DelPythonFiles "True"
82 # test if Acrobat or Adobe Reader is used as PDF-viewer
83 ReadRegStr $String HKCR ".pdf" ""
84 ${if} $String != "AcroExch.Document" # this name is only used by Acrobat and Adobe Reader
85 StrCpy $Acrobat "None"
90 # test if a PostScript-viewer is installed, only check for GSview32
92 ReadRegStr $PSVPath HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\gsview32.exe" "Path"
94 # test if an editor with syntax-highlighting for LaTeX-files is installed
97 # test if an image editor is installed
98 StrCpy $ImageEditorPath ""
99 ReadRegStr $ImageEditorPath HKLM "Software\Classes\GIMP-2.8-xcf\shell\open\command" ""
100 ${if} $ImageEditorPath != ""
101 StrCpy $ImageEditorPath "$ImageEditorPath" -19 # delete '\gimp-2.x.exe" "%1"'
102 StrCpy $ImageEditorPath $ImageEditorPath "" 1 # remove the leading quote
104 # check for Photoshop
105 ReadRegStr $0 HKLM "Software\Classes\Applications\Photoshop.exe\shell\open\command" ""
107 StrCpy $0 "$0" -20 # delete '\photoshop.exe" "%1"'
108 StrCpy $0 $0 "" 1 # remove the leading quote
109 ${if} $ImageEditorPath != ""
110 StrCpy $ImageEditorPath "$ImageEditorPath;$0"
112 StrCpy $ImageEditorPath $0
116 # test if and where the BibTeX-editor JabRef is installed
117 ReadRegStr $PathBibTeXEditor HKCU "Software\JabRef" "Path"
118 ${if} $PathBibTeXEditor == ""
119 ReadRegStr $PathBibTeXEditor HKLM "Software\JabRef" "Path"
122 ${IfNot} ${FileExists} "$PathBibTeXEditor\${BIN_BIBTEXEDITOR}"
123 StrCpy $PathBibTeXEditor ""
124 StrCpy $JabRefInstalled == "No"
126 StrCpy $JabRefInstalled == "Yes"
129 # test if and where LilyPond is installed
130 ReadRegStr $LilyPondPath HKLM "Software\LilyPond" "Install_Dir"
131 ${if} $LilyPondPath != ""
132 StrCpy $LilyPondPath "$LilyPondPath\usr\bin" # add "\usr\bin"
135 # test if Inkscape is installed
136 ReadRegStr $SVGPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Inkscape" "InstallLocation"
138 # test if Gnumeric is installed
139 ReadRegStr $0 HKLM "Software\Classes\Applications\gnumeric.exe\shell\Open\command" ""
141 StrCpy $0 $0 -18 # remove "gnumeric.exe" "%1""
142 StrCpy $0 $0 "" 1 # remove the leading quote
143 StrCpy $GnumericPath $0
148 # ---------------------------------------
150 Function FindDictionaries
151 # find the installed dictionaries
153 # start with empty strings
157 # read out the possible spell-checker filenames from the file
158 FileOpen $R5 "$INSTDIR\Resources\HunspellDictionaryNames.txt" r
160 # the file has 120 lines, but we only need to check for one of the 2 dictionary files per language
161 # therefore check only for every second line
162 FileRead $R5 $String # $String is now the dictionary name
163 FileRead $R5 $String # $String is now the dictionary name
164 StrCpy $String $String -2 # remove the linebreak characters
165 StrCpy $R3 $String -4 # $R3 is now the dictionary language code
166 # we have 2 cases where we renamed the file to a 3 letter code, see thesaurus.nsh
167 ${if} $String == "db_DE.dic"
168 StrCpy $String "dsb_DE.dic"
170 ${if} $String == "hb_DE.dic"
171 StrCpy $String "hsb_DE.dic"
173 !insertmacro FileCheck $4 $String "$INSTDIR\Resources\dicts" # macro from LyXUtils.nsh
175 StrCpy $FoundDict "$R3 $FoundDict"
180 # read out the possible thesaurus filenames from the file
181 FileOpen $R5 "$INSTDIR\Resources\ThesaurusDictionaryNames.txt" r
183 # the file has 44 lines, but we only need to check for one of the 2 dictionary files per language
184 # therefore check only for every second line
185 FileRead $R5 $String # $String is now the dictionary name
186 FileRead $R5 $String # $String is now the dictionary name
187 StrCpy $String $String -2 # remove the linebreak characters
188 StrCpy $R3 $String 5 3 # $R3 is now the dictionary language code
189 !insertmacro FileCheck $4 $String "$INSTDIR\Resources\thes" # macro from LyXUtils.nsh
191 StrCpy $FoundThes "$R3 $FoundThes"
198 # ---------------------------------------
201 # test if an editor with syntax-highlighting for LaTeX-files is installed
203 # (check for jEdit, PSPad, WinShell, ConTEXT, Crimson Editor, Vim, TeXnicCenter, LaTeXEditor, WinEdt, LEd, WinTeX)
204 StrCpy $EditorPath ""
207 ReadRegStr $EditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\jEdit_is1" "InstallLocation"
208 ${if} $EditorPath != ""
209 StrCpy $EditorPath $EditorPath -1 # remove "\" from the end of the string
213 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PSPad editor_is1" "InstallLocation"
216 StrCpy $EditorPath "$EditorPath;$0"
220 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinShell_is1" "InstallLocation"
223 StrCpy $EditorPath "$EditorPath;$0"
227 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ConTEXTEditor_is1" "InstallLocation"
230 StrCpy $EditorPath "$EditorPath;$0"
232 # check for Crimson Editor
234 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Crimson Editor" "UninstallString"
236 StrCpy $0 $0 -14 # remove "\uninstall.exe"
237 StrCpy $EditorPath "$EditorPath;$0"
241 ReadRegStr $0 HKLM "Software\Classes\Applications\gvim.exe\shell\edit\command" ""
243 StrCpy $0 $0 -13 # remove "gvim.exe "%1""
244 StrCpy $EditorPath "$EditorPath;$0"
248 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Vim 7.0" "UninstallString"
250 StrCpy $0 $0 -18 # remove "\uninstall-gui.exe"
251 StrCpy $EditorPath "$EditorPath;$0"
253 # check for TeXnicCenter
255 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TeXnicCenter_is1" "Inno Setup: App Path"
257 StrCpy $EditorPath "$EditorPath;$0"
259 # check for LaTeXEditor
261 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LaTeX Editor" "InstallLocation"
263 StrCpy $EditorPath "$EditorPath;$0"
267 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinEdt_is1" "InstallLocation"
270 StrCpy $EditorPath "$EditorPath;$0"
274 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LEd_is1" "InstallLocation"
277 StrCpy $EditorPath "$EditorPath;$0"
281 ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinTeX XP" "DisplayIcon"
283 StrCpy $0 $0 -11 # remove "\wintex.exe"
284 StrCpy $EditorPath "$EditorPath;$0"