3 !if ${INSTALLER_TYPE} == "NotUpdate" # only for Small and Complete installer
6 # install Aspell when it is not already installed
8 ${if} $AspellPath == ""
9 # extract Aspell's program files
10 SetOutPath "$INSTDIR\external"
11 File /r "${PRODUCT_SOURCEDIR}\${AspellInstall}"
12 # copy the files and register Aspell
13 CopyFiles "$INSTDIR\${AspellInstall}" "$APPDATA"
15 WriteRegStr HKLM "SOFTWARE\Aspell" "Base Path" "${AspellDir}"
16 WriteRegStr HKLM "SOFTWARE\Aspell" "Dictionary Path" "${AspellDictPath}"
17 WriteRegStr HKLM "SOFTWARE\Aspell" "Personal Path" "${AspellPersonalPath}"
19 WriteRegStr HKLM "Software\Aspell" "OnlyWithLyX" "Yes${PRODUCT_VERSION_SHORT}" # special entry to tell the uninstaller that it was installed with LyX
21 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Aspell" "DisplayName" "${AspellDisplay}"
22 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Aspell" "NoModify" 0x00000001
23 WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Aspell" "NoRepair" 0x00000001
24 WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Aspell" "UninstallString" "${AspellDir}\${AspellUninstall}"
29 !endif # endif ${INSTALLER_TYPE} == "NotUpdate"
31 #--------------------------------
33 !if ${INSTALLER_TYPE} == "NotUpdate" # only for Small and Complete installer
35 Function DownloadDictionary
36 # Downloads Aspell dictionaries from a location that is given in the file
37 # $INSTDIR\Resources\AspellDictionaryNames.txt
39 # read out the locations from the file
40 FileOpen $R5 "$INSTDIR\Resources\AspellDictionaryNames.txt" r
42 FileRead $R5 $String # $String is now the dictionary name
43 StrCpy $R3 $String 2 # $R3 is now the dictionary language code
45 ${andif} $DictCode != "tr" # if nothing was found (the last line in the file starts with "tr")
48 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
51 ${LoopUntil} $DictCode == $R3
54 StrCpy $String $String -2 # delete the linebreak characters at the end
56 # Download aspell dictionaries,
57 # if first download repository is not available try the other ones listed in "AspellRepositories.txt"
58 FileOpen $R5 "$INSTDIR\Resources\AspellRepositories.txt" r
60 FileRead $R5 $Search # $Search is now the AspellLocation
61 StrCpy $Search $Search -2 # delete the linebreak characters at the end
63 InetLoad::load /TIMEOUT=5000 "$Search/aspell6-$String.exe" "$INSTDIR\aspell6-$String.exe" /END
65 # test if the downloaded file is really the expected one, because if the file didn't exist on the download server,
66 # berlios.de downloads a text file with the name of the non-existing file that contains the line "File doesn't exist"
67 FileOpen $R4 "$INSTDIR\aspell6-$String.exe" r
70 StrCpy $Search $Search -1 # delete the unix linebreak character at the end
71 ${if} $Search == "File doesn't exist"
82 MessageBox MB_OK|MB_ICONEXCLAMATION "$(AspellDownloadFailed) $R0"
83 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
88 ExecWait '"$INSTDIR\aspell6-$String.exe" /NoDirChange /AutoClose'
89 ${if} $AspellBaseReg == "HKLM"
90 ReadRegStr $R2 HKLM "Software\Aspell\Dictionaries" $DictCode
92 ReadRegStr $R2 HKCU "Software\Aspell\Dictionaries" $DictCode
95 MessageBox MB_OK|MB_ICONEXCLAMATION "$(AspellInstallFailed)"
96 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
100 Delete "$INSTDIR\aspell6-$String.exe"
104 !endif # endif ${INSTALLER_TYPE} == "NotUpdate"
106 #--------------------------------
108 !if ${INSTALLER_TYPE} == "NotUpdate" # only for Small and Complete installer
110 Function InstallAspellDictionary
111 # install Aspell dictionaries
113 # we only have a norwegian dictionary available
114 ${if} $LangCode == "nb_NO"
115 StrCpy $LangCode "no_NO"
118 StrCpy $AspellInstallYes ""
120 # install the english dictionary if not already installed
121 StrCpy $DictCode "en"
122 StrCpy $RunNumber "1"
123 ${if} $AspellBaseReg == "HKLM" # $AspellBaseReg is either "HKLM" or if Aspell is already installed only for the current user "HKCU"
124 ReadRegStr $R2 HKLM "Software\Aspell\Dictionaries" $DictCode
126 ReadRegStr $R2 HKCU "Software\Aspell\Dictionaries" $DictCode
129 MessageBox MB_OK|MB_ICONINFORMATION "$(AspellInfo)"
130 StrCpy $AspellMessage "Yes"
131 Call DownloadDictionary
133 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
136 # install the dictionary corresponding to the system and the chosen menu language
137 # check if the system language and the chosen menu language are the same, if not install
139 StrCpy $DictCode $LangCode 2
140 StrCpy $0 $DictCode # $0 is now the language code of the chosen LyX menu language
141 StrCpy $RunNumber "2"
142 ${if} $AspellInstallYes == "1"
143 ${andif} $DictCode == "en"
144 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
146 ${if} $AspellBaseReg == "HKLM"
147 ReadRegStr $R2 HKLM "Software\Aspell\Dictionaries" $DictCode
149 ReadRegStr $R2 HKCU "Software\Aspell\Dictionaries" $DictCode
152 ${if} $AspellMessage != "Yes"
153 MessageBox MB_OK|MB_ICONINFORMATION "$(AspellInfo)"
155 Call DownloadDictionary
157 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
159 ${endif} # endif $AspellInstallYes == "1"
160 ${if} $LangCodeSys != $DictCode
161 StrCpy $RunNumber "3"
162 ${if} $LangCodeSys == "en"
163 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
165 StrCpy $DictCode $LangCodeSys
166 ${if} $AspellBaseReg == "HKLM"
167 ReadRegStr $R2 HKLM "Software\Aspell\Dictionaries" $DictCode
169 ReadRegStr $R2 HKCU "Software\Aspell\Dictionaries" $DictCode
172 ${if} $AspellMessage != "Yes"
173 MessageBox MB_OK|MB_ICONINFORMATION "$(AspellInfo)"
175 Call DownloadDictionary
177 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
179 ${endif} # endif $LangCodeSys == "en"
180 ${else} # else ${if} $LangCodeSys != $DictCode
181 StrCpy $AspellInstallYes "4$AspellInstallYes"
184 # check the registry to divide between nothing installed or all already installed
185 ${if} $AspellInstallYes == "321"
186 ${orif} $AspellInstallYes == "421"
187 ${if} $AspellBaseReg == "HKLM"
188 ReadRegStr $R2 HKLM "Software\Aspell\Dictionaries" "en"
190 ReadRegStr $R2 HKCU "Software\Aspell\Dictionaries" "en"
194 ${andif} $LangCodeSys == "en"
195 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellAll) English$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
198 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellAll) English$(AspellPartAnd)$LangNameSys$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
200 ${if} $LangCodeSys == "en"
201 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellAll) English$(AspellPartAnd)$LangName$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
203 ${if} $LangCodeSys != $0
204 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellAll) English$(AspellPartSep)$LangName$(AspellPartAnd)$LangNameSys$\r$\n$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
206 ${if} $LangCodeSys == $0
207 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellAll) English$(AspellPartAnd)$LangName$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
212 Delete "$INSTDIR\Resources\AspellDictionaryNames.txt"
213 Delete "$INSTDIR\Resources\AspellRepositories.txt"
215 # show message about Aspell dictionaries
216 # the code rule to display the correct message:
217 # - when the englisch dictionary is already installed or couldn't be installed -> set a "1"
218 # - when the dictionary of the chosen LyX menu language is already installed or couldn't be installed -> set a "2"
219 # - when the dictionary of the Windows system language is already installed or couldn't be installed -> set a "3"
220 # - when the dictionary of the chosen LyX menu language is equal to the dictionary of the Windows system language -> set a "4"
221 ${if} $AspellInstallYes == "32"
222 ${orif} $AspellInstallYes == "42"
223 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart1)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
225 ${if} $AspellInstallYes == "3"
226 ${orif} $AspellInstallYes == "4"
227 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart1)$(AspellPartAnd)$(AspellPart2)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
229 ${if} $AspellInstallYes == "2"
230 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart1)$(AspellPartAnd)$(AspellPart3)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
232 ${if} $AspellInstallYes == ""
233 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart1)$(AspellPartSep)$(AspellPart2)$(AspellPartAnd)$(AspellPart3)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
235 ${if} $AspellInstallYes == "321"
236 ${orif} $AspellInstallYes == "421"
237 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellNone)" IDYES DownloadNow IDNO DownloadLater
239 ${if} $AspellInstallYes == "31"
240 ${orif} $AspellInstallYes == "41"
241 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart2)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
243 ${if} $AspellInstallYes == "21"
244 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart3)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
246 ${if} $AspellInstallYes == "1"
247 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart2)$(AspellPartAnd)$(AspellPart3)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
251 ExecShell "open" "${AspellLocationExact}"
256 !endif # endif ${INSTALLER_TYPE} == "NotUpdate"
258 #---------------------------
261 Function un.UninstAspell
263 ReadRegStr $1 SHCTX "Software\Aspell" "Base Path"
264 # delete Aspells' install folder
266 # unregister Aspell and its dictionaries
267 DeleteRegKey SHCTX "Software\Aspell"
268 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell"
269 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-af"
270 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-am"
271 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ar"
272 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-az"
273 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-be"
274 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-bg"
275 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-bn"
276 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-br"
277 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ca"
278 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-cs"
279 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-csb"
280 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-cy"
281 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-da"
282 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-de"
283 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-en"
284 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-el"
285 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-eo"
286 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-es"
287 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-et"
288 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-fa"
289 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-fi"
290 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-fo"
291 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-fr"
292 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ga"
293 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-gd"
294 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-gl"
295 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-gu"
296 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-gv"
297 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-he"
298 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-hi"
299 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-hil"
300 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-hr"
301 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-hsb"
302 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-hu"
303 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ia"
304 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-id"
305 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-is"
306 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-it"
307 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ku"
308 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-la"
309 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-lt"
310 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-lv"
311 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mg"
312 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mi"
313 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mk"
314 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mn"
315 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mr"
316 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ms"
317 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mt"
318 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-nb"
319 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-nds"
320 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-nl"
321 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-nn"
322 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-no"
323 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ny"
324 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-or"
325 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-pa"
326 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-pl"
327 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-pt"
328 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-qu"
329 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ro"
330 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ru"
331 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-rw"
332 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sc"
333 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sk"
334 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sl"
335 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sr"
336 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sv"
337 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sw"
338 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ta"
339 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-te"
340 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-tet"
341 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-tl"
342 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-tn"
343 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-tr"
344 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-uk"
345 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-uz"
346 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-vi"
347 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-wa"
348 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-yi"
349 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-zu"