3 Function DownloadDictionary
5 FileOpen $R5 "$INSTDIR\Resources\AspellDictionaryNames.txt" r
7 FileRead $R5 $String # $String is now the dictionary name
8 StrCpy $R3 $String 2 # $R3 is now the dictionary language code
10 ${andif} $DictCode != "tr" # if nothing was found (the last line in the file starts with "tr")
13 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
16 ${LoopUntil} $DictCode == $R3
19 StrCpy $String $String -2 # delete the linebreak characters at the end
21 # Download aspell dictionaries,
22 # if first download repository is not available try the other ones listed in "AspellRepositories.txt"
23 FileOpen $R5 "$INSTDIR\Resources\AspellRepositories.txt" r
25 FileRead $R5 $Search # $Search is now the AspellLocation
26 StrCpy $Search $Search -2 # delete the linebreak characters at the end
28 InetLoad::load /TIMEOUT=5000 "$Search/aspell6-$String.exe" "$INSTDIR\aspell6-$String.exe" /END
30 # test if the downloaded file is really the expected one, because if the file didn't exist on the download server,
31 # berlios.de downloads a text file with the name of the non-existing file that contains the line "File doesn't exist"
32 FileOpen $R4 "$INSTDIR\aspell6-$String.exe" r
35 StrCpy $Search $Search -1 # delete the unix linebreak character at the end
36 ${if} $Search == "File doesn't exist"
47 MessageBox MB_OK|MB_ICONEXCLAMATION "$(AspellDownloadFailed) $R0"
48 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
53 ExecWait '"$INSTDIR\aspell6-$String.exe" /NoDirChange /AutoClose'
54 ${if} $AspellBaseReg == "HKLM"
55 ReadRegStr $R2 HKLM "Software\Aspell\Dictionaries" $DictCode
57 ReadRegStr $R2 HKCU "Software\Aspell\Dictionaries" $DictCode
60 MessageBox MB_OK|MB_ICONEXCLAMATION "$(AspellInstallFailed)"
61 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
65 Delete "$INSTDIR\aspell6-$String.exe"
69 #--------------------------------
71 Function InstallAspellDictionary
73 StrCpy $AspellInstallYes ""
75 # install the english dictionary if not already installed
78 ${if} $AspellBaseReg == "HKLM" # $AspellBaseReg is either "HKLM" or if Aspell is already installed only for the current user "HKCU"
79 ReadRegStr $R2 HKLM "Software\Aspell\Dictionaries" $DictCode
81 ReadRegStr $R2 HKCU "Software\Aspell\Dictionaries" $DictCode
84 MessageBox MB_OK|MB_ICONINFORMATION "$(AspellInfo)"
85 StrCpy $AspellMessage "Yes"
86 Call DownloadDictionary
88 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
91 # install the dictionary corresponding to the system and the chosen menu language
92 # check if the system language and the chosen menu language are the same, if not install
94 StrCpy $DictCode $LangCode 2
95 StrCpy $0 $DictCode # $0 is now the language code of the chosen LyX menu language
97 ${if} $AspellInstallYes == "1"
98 ${andif} $DictCode == "en"
99 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
101 ${if} $AspellBaseReg == "HKLM"
102 ReadRegStr $R2 HKLM "Software\Aspell\Dictionaries" $DictCode
104 ReadRegStr $R2 HKCU "Software\Aspell\Dictionaries" $DictCode
107 ${if} $AspellMessage != "Yes"
108 MessageBox MB_OK|MB_ICONINFORMATION "$(AspellInfo)"
110 Call DownloadDictionary
112 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
114 ${endif} # endif $AspellInstallYes == "1"
115 ${if} $LangCodeSys != $DictCode
116 StrCpy $RunNumber "3"
117 ${if} $LangCodeSys == "en"
118 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
120 StrCpy $DictCode $LangCodeSys
121 ${if} $AspellBaseReg == "HKLM"
122 ReadRegStr $R2 HKLM "Software\Aspell\Dictionaries" $DictCode
124 ReadRegStr $R2 HKCU "Software\Aspell\Dictionaries" $DictCode
127 ${if} $AspellMessage != "Yes"
128 MessageBox MB_OK|MB_ICONINFORMATION "$(AspellInfo)"
130 Call DownloadDictionary
132 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
134 ${endif} # endif $LangCodeSys == "en"
135 ${else} # else ${if} $LangCodeSys != $DictCode
136 StrCpy $AspellInstallYes "4$AspellInstallYes"
139 # check the registry to divide between nothing installed or all already installed
140 ${if} $AspellInstallYes == "321"
141 ${orif} $AspellInstallYes == "421"
142 ${if} $AspellBaseReg == "HKLM"
143 ReadRegStr $R2 HKLM "Software\Aspell\Dictionaries" "en"
145 ReadRegStr $R2 HKCU "Software\Aspell\Dictionaries" "en"
149 ${andif} $LangCodeSys == "en"
150 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellAll) English$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
153 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellAll) English$(AspellPartAnd)$LangNameSys$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
155 ${if} $LangCodeSys == "en"
156 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellAll) English$(AspellPartAnd)$LangName$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
158 ${if} $LangCodeSys != $0
159 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellAll) English$(AspellPartSep)$LangName$(AspellPartAnd)$LangNameSys$\r$\n$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
161 ${if} $LangCodeSys == $0
162 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellAll) English$(AspellPartAnd)$LangName$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
167 Delete "$INSTDIR\Resources\AspellDictionaryNames.txt"
168 Delete "$INSTDIR\Resources\AspellRepositories.txt"
170 # show message about Aspell dictionaries
171 # the code rule to display the correct message:
172 # - when the englisch dictionary is already installed or couldn't be installed -> set a "1"
173 # - when the dictionary of the chosen LyX menu language is already installed or couldn't be installed -> set a "2"
174 # - when the dictionary of the Windows system language is already installed or couldn't be installed -> set a "3"
175 # - when the dictionary of the chosen LyX menu language is equal to the dictionary of the Windows system language -> set a "4"
176 ${if} $AspellInstallYes == "32"
177 ${orif} $AspellInstallYes == "42"
178 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart1)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
180 ${if} $AspellInstallYes == "3"
181 ${orif} $AspellInstallYes == "4"
182 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart1)$(AspellPartAnd)$(AspellPart2)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
184 ${if} $AspellInstallYes == "2"
185 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart1)$(AspellPartAnd)$(AspellPart3)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
187 ${if} $AspellInstallYes == ""
188 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart1)$(AspellPartSep)$(AspellPart2)$(AspellPartAnd)$(AspellPart3)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
190 ${if} $AspellInstallYes == "321"
191 ${orif} $AspellInstallYes == "421"
192 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellNone)" IDYES DownloadNow IDNO DownloadLater
194 ${if} $AspellInstallYes == "31"
195 ${orif} $AspellInstallYes == "41"
196 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart2)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
198 ${if} $AspellInstallYes == "21"
199 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart3)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
201 ${if} $AspellInstallYes == "1"
202 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart2)$(AspellPartAnd)$(AspellPart3)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
206 ExecShell "open" "${AspellLocationExact}"
211 #---------------------------
213 Function un.UninstAspell
215 ReadRegStr $1 SHCTX "Software\Aspell" "Base Path"
216 # delete Aspells' install folder
218 # unregister Aspell and its dictionaries
219 DeleteRegKey SHCTX "Software\Aspell"
220 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell"
221 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-af"
222 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-am"
223 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ar"
224 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-az"
225 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-be"
226 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-bg"
227 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-bn"
228 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-br"
229 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ca"
230 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-cs"
231 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-csb"
232 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-cy"
233 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-da"
234 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-de"
235 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-en"
236 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-el"
237 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-eo"
238 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-es"
239 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-et"
240 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-fa"
241 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-fi"
242 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-fo"
243 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-fr"
244 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ga"
245 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-gd"
246 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-gl"
247 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-gu"
248 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-gv"
249 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-he"
250 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-hi"
251 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-hil"
252 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-hr"
253 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-hsb"
254 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-hu"
255 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ia"
256 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-id"
257 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-is"
258 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-it"
259 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ku"
260 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-la"
261 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-lt"
262 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-lv"
263 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mg"
264 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mi"
265 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mk"
266 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mn"
267 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mr"
268 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ms"
269 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mt"
270 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-nb"
271 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-nds"
272 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-nl"
273 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-nn"
274 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-no"
275 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ny"
276 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-or"
277 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-pa"
278 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-pl"
279 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-pt"
280 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-qu"
281 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ro"
282 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ru"
283 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-rw"
284 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sc"
285 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sk"
286 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sl"
287 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sr"
288 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sv"
289 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sw"
290 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ta"
291 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-te"
292 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-tet"
293 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-tl"
294 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-tn"
295 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-tr"
296 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-uk"
297 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-uz"
298 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-vi"
299 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-wa"
300 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-yi"
301 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-zu"