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 StrCpy $AspellInstallYes ""
115 # install the english dictionary if not already installed
116 StrCpy $DictCode "en"
117 StrCpy $RunNumber "1"
118 ${if} $AspellBaseReg == "HKLM" # $AspellBaseReg is either "HKLM" or if Aspell is already installed only for the current user "HKCU"
119 ReadRegStr $R2 HKLM "Software\Aspell\Dictionaries" $DictCode
121 ReadRegStr $R2 HKCU "Software\Aspell\Dictionaries" $DictCode
124 MessageBox MB_OK|MB_ICONINFORMATION "$(AspellInfo)"
125 StrCpy $AspellMessage "Yes"
126 Call DownloadDictionary
128 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
131 # install the dictionary corresponding to the system and the chosen menu language
132 # check if the system language and the chosen menu language are the same, if not install
134 StrCpy $DictCode $LangCode 2
135 StrCpy $0 $DictCode # $0 is now the language code of the chosen LyX menu language
136 StrCpy $RunNumber "2"
137 ${if} $AspellInstallYes == "1"
138 ${andif} $DictCode == "en"
139 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
141 ${if} $AspellBaseReg == "HKLM"
142 ReadRegStr $R2 HKLM "Software\Aspell\Dictionaries" $DictCode
144 ReadRegStr $R2 HKCU "Software\Aspell\Dictionaries" $DictCode
147 ${if} $AspellMessage != "Yes"
148 MessageBox MB_OK|MB_ICONINFORMATION "$(AspellInfo)"
150 Call DownloadDictionary
152 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
154 ${endif} # endif $AspellInstallYes == "1"
155 ${if} $LangCodeSys != $DictCode
156 StrCpy $RunNumber "3"
157 ${if} $LangCodeSys == "en"
158 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
160 StrCpy $DictCode $LangCodeSys
161 ${if} $AspellBaseReg == "HKLM"
162 ReadRegStr $R2 HKLM "Software\Aspell\Dictionaries" $DictCode
164 ReadRegStr $R2 HKCU "Software\Aspell\Dictionaries" $DictCode
167 ${if} $AspellMessage != "Yes"
168 MessageBox MB_OK|MB_ICONINFORMATION "$(AspellInfo)"
170 Call DownloadDictionary
172 StrCpy $AspellInstallYes "$RunNumber$AspellInstallYes"
174 ${endif} # endif $LangCodeSys == "en"
175 ${else} # else ${if} $LangCodeSys != $DictCode
176 StrCpy $AspellInstallYes "4$AspellInstallYes"
179 # check the registry to divide between nothing installed or all already installed
180 ${if} $AspellInstallYes == "321"
181 ${orif} $AspellInstallYes == "421"
182 ${if} $AspellBaseReg == "HKLM"
183 ReadRegStr $R2 HKLM "Software\Aspell\Dictionaries" "en"
185 ReadRegStr $R2 HKCU "Software\Aspell\Dictionaries" "en"
189 ${andif} $LangCodeSys == "en"
190 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellAll) English$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
193 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellAll) English$(AspellPartAnd)$LangNameSys$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
195 ${if} $LangCodeSys == "en"
196 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellAll) English$(AspellPartAnd)$LangName$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
198 ${if} $LangCodeSys != $0
199 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellAll) English$(AspellPartSep)$LangName$(AspellPartAnd)$LangNameSys$\r$\n$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
201 ${if} $LangCodeSys == $0
202 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellAll) English$(AspellPartAnd)$LangName$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
207 Delete "$INSTDIR\Resources\AspellDictionaryNames.txt"
208 Delete "$INSTDIR\Resources\AspellRepositories.txt"
210 # show message about Aspell dictionaries
211 # the code rule to display the correct message:
212 # - when the englisch dictionary is already installed or couldn't be installed -> set a "1"
213 # - when the dictionary of the chosen LyX menu language is already installed or couldn't be installed -> set a "2"
214 # - when the dictionary of the Windows system language is already installed or couldn't be installed -> set a "3"
215 # - when the dictionary of the chosen LyX menu language is equal to the dictionary of the Windows system language -> set a "4"
216 ${if} $AspellInstallYes == "32"
217 ${orif} $AspellInstallYes == "42"
218 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart1)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
220 ${if} $AspellInstallYes == "3"
221 ${orif} $AspellInstallYes == "4"
222 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart1)$(AspellPartAnd)$(AspellPart2)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
224 ${if} $AspellInstallYes == "2"
225 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart1)$(AspellPartAnd)$(AspellPart3)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
227 ${if} $AspellInstallYes == ""
228 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart1)$(AspellPartSep)$(AspellPart2)$(AspellPartAnd)$(AspellPart3)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
230 ${if} $AspellInstallYes == "321"
231 ${orif} $AspellInstallYes == "421"
232 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellNone)" IDYES DownloadNow IDNO DownloadLater
234 ${if} $AspellInstallYes == "31"
235 ${orif} $AspellInstallYes == "41"
236 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart2)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
238 ${if} $AspellInstallYes == "21"
239 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart3)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
241 ${if} $AspellInstallYes == "1"
242 MessageBox MB_ICONINFORMATION|MB_DEFBUTTON2|MB_YESNO "$(AspellPartStart)$(AspellPart2)$(AspellPartAnd)$(AspellPart3)$(AspellPart4)" IDYES DownloadNow IDNO DownloadLater
246 ExecShell "open" "${AspellLocationExact}"
251 !endif # endif ${INSTALLER_TYPE} == "NotUpdate"
253 #---------------------------
256 Function un.UninstAspell
258 ReadRegStr $1 SHCTX "Software\Aspell" "Base Path"
259 # delete Aspells' install folder
261 # unregister Aspell and its dictionaries
262 DeleteRegKey SHCTX "Software\Aspell"
263 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell"
264 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-af"
265 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-am"
266 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ar"
267 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-az"
268 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-be"
269 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-bg"
270 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-bn"
271 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-br"
272 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ca"
273 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-cs"
274 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-csb"
275 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-cy"
276 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-da"
277 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-de"
278 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-en"
279 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-el"
280 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-eo"
281 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-es"
282 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-et"
283 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-fa"
284 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-fi"
285 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-fo"
286 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-fr"
287 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-fy"
288 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ga"
289 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-gd"
290 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-gl"
291 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-gu"
292 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-gv"
293 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-he"
294 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-hi"
295 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-hil"
296 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-hr"
297 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-hsb"
298 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-hu"
299 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-hy"
300 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ia"
301 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-id"
302 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-is"
303 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-it"
304 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ku"
305 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-la"
306 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-lt"
307 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-lv"
308 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mg"
309 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mi"
310 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mk"
311 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ml"
312 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mn"
313 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mr"
314 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ms"
315 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-mt"
316 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-nb"
317 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-nds"
318 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-nl"
319 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-nn"
320 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-no"
321 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ny"
322 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-or"
323 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-pa"
324 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-pl"
325 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-pt"
326 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-qu"
327 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ro"
328 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ru"
329 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-rw"
330 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sc"
331 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sk"
332 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sl"
333 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sr"
334 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sv"
335 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-sw"
336 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-ta"
337 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-te"
338 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-tet"
339 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-tl"
340 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-tn"
341 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-tr"
342 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-uk"
343 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-uz"
344 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-vi"
345 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-wa"
346 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-yi"
347 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\Aspell6-Dictionary-zu"