3 ; this function is called at first after starting the uninstaller
6 ; Check that LyX is not currently running
7 FindProcDLL::FindProc "lyx.exe"
9 MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)"
13 ; Ascertain whether the user has sufficient privileges to uninstall.
14 SetShellVarContext current
16 ReadRegStr $0 HKCU "${PRODUCT_UNINST_KEY}" "RootKey"
18 ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "RootKey"
20 MessageBox MB_OK|MB_ICONEXCLAMATION "$(UnNotInRegistryLabel)"
24 ; If the user does *not* have administrator privileges, abort
26 !insertmacro IsUserAdmin $Answer $UserName ; macro from LyXUtils.nsh
27 ${if} $Answer == "yes"
28 SetShellVarContext all
30 MessageBox MB_OK|MB_ICONSTOP "$(UnNotAdminLabel)"
34 ; Macro to investigate name of LyX's preferences folders to be able remove them
35 !insertmacro UnAppPreSuff $AppPre $AppSuff ; macro from LyXUtils.nsh
37 ; test if Aspell was installed together with LyX
38 ReadRegStr $0 HKLM "Software\Aspell" "OnlyWithLyX" ; special entry to test if it was installed with LyX
39 ${if} $0 == "Yes${PRODUCT_VERSION_SHORT}"
40 SectionSetText 2 "Aspell" ; names the corersponding uninstaller section (has the index "2" as it is the third section in Uninstall.nsh)
41 StrCpy $AspellInstallYes "Aspell"
43 SectionSetText 2 "" ; hides the corresponding uninstaller section
46 ; test if MiKTeX was installed together with LyX
47 ReadRegStr $0 HKLM "SOFTWARE\MiKTeX.org\MiKTeX" "OnlyWithLyX"
48 ${if} $0 == "Yes${PRODUCT_VERSION_SHORT}"
49 SectionSetText 3 "MiKTeX" ; names the corersponding uninstaller section
50 StrCpy $MiKTeXInstalled "MiKTeX"
52 SectionSetText 3 "" ; hides the corresponding uninstaller section
55 ; ignore JabRef because this could only be installed with the complete installer version
56 SectionSetText 4 "" ; hides the corresponding uninstaller section
57 StrCpy $JabRefInstalled ""
59 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "$(UnReallyRemoveLabel)" IDYES +2
65 Function un.onUninstSuccess
67 MessageBox MB_ICONINFORMATION|MB_OK "$(UnRemoveSuccessLabel)"
73 Section "un.LyX" un.SecUnProgramFiles
77 ; delete LaTeX class files that were installed together with LyX
78 FileOpen $R5 "$INSTDIR\Resources\uninstallPaths.dat" r
79 FileRead $R5 $LatexPath
81 StrCpy $String $LatexPath
82 StrCpy $Search "miktex\bin"
84 Call un.StrPoint ; search the LaTeXPath for the phrase "miktex\bin" (function from LyXUtils.nsh)
85 ${if} $Pointer != "-1" ; if something was found
86 IntOp $Pointer $Pointer - 1 ; jump before the first "\" of "\miktex\bin"
87 StrCpy $String $String "$Pointer" ; $String is now the part before "\miktex\bin"
88 Delete "$String\tex\latex\cv.cls"
89 RMDir /r "$String\tex\latex\lyx"
90 RMDir /r "$String\tex\latex\revtex"
91 RMDir /r "$String\tex\latex\hollywood"
92 RMDir /r "$String\tex\latex\broadway"
93 ExecWait "$LatexPath\initexmf --update-fndb"
96 ; delete LyX's installation folder
98 ; delete start menu folder
99 ReadRegStr $0 ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "StartMenu"
101 ; delete desktop icon
102 Delete "$DESKTOP\LyX ${PRODUCT_VERSION}.lnk"
103 ; delete registry entries
104 DeleteRegKey HKCU "${PRODUCT_UNINST_KEY}"
105 DeleteRegKey ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
106 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
107 DeleteRegKey HKCR "Applications\lyx.exe"
108 DeleteRegKey HKCR "Applications\lyx.bat"
111 !insertmacro FileCheck $5 "meanings.dat" "${AiksaurusDir}" ; macro from LyXUtils.nsh
113 RMDir /r "${AiksaurusDir}"
116 ; ReadRegStr $0 HKLM "Software\Aiksaurus" "OnlyWithLyX" ; special entry to test if it was installed with LyX
117 ; ${if} $0 == "Yes${PRODUCT_VERSION_SHORT}"
118 ; ; unregister Aiksaurus
119 ; ReadRegStr $1 HKLM "Software\Aiksaurus" "Data Path"
121 ; DeleteRegKey HKLM "SOFTWARE\Aiksaurus"
126 ReadRegStr $0 HKLM "Software\ImageMagick" "OnlyWithLyX" ; special entry to test if it was installed with LyX
127 ${if} $0 == "Yes${PRODUCT_VERSION_SHORT}"
128 ; unregister ImageMagick
129 DeleteRegValue HKLM "SOFTWARE\Classes\Applications" "AutoRun"
130 DeleteRegKey HKLM "SOFTWARE\ImageMagick"
133 ; Ghostscript and GSview
136 ReadRegStr $0 HKLM "SOFTWARE\GPL Ghostscript" "OnlyWithLyX" ; special entry to test if it was installed with LyX
137 ${if} $0 == "Yes${PRODUCT_VERSION_SHORT}"
138 ; unregister Ghostscript
139 DeleteRegKey HKLM "SOFTWARE\GPL Ghostscript"
140 ; test if GSview is installed
141 EnumRegValue $5 HKLM "Software\Ghostgum\GSview" 0
144 MessageBox MB_ICONINFORMATION|MB_OK "$(UnGSview)"
145 ReadRegStr $3 HKLM "Software\Ghostgum\GSview" "$5"
146 ReadRegStr $4 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GSview $5" "UninstallString"
151 ; MiKTeX specific LyX setting
152 DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "MIKTEX_AUTOINSTALL"
153 DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "MIKTEX_REPOSITORY"
155 ; remove extension .lyx
156 ${RemoveFileAssociation} "${PRODUCT_EXT}" "${PRODUCT_NAME}"
157 DeleteRegKey HKCR "${PRODUCT_NAME}"
163 ;---------------------------------
165 Section "un.$(UnLyXPreferencesTitle)" un.SecUnPreferences
167 ; remove LyX's config files
168 Call un.DelAppPathSub ; function from LyXUtils.nsh
172 ;---------------------------------
174 Section "un.Aspell" un.SecUnAspell
176 ${if} $AspellInstallYes == "Aspell" ; only uninstall Aspell when it was installed together with LyX
177 Call un.UninstAspell ; Function from Aspell.nsh
182 ;---------------------------------
184 Section "un.MiKTeX" un.SecUnMiKTeX
186 ${if} $MiKTeXInstalled == "MiKTeX" ; only uninstall MiKTeX when it was installed together with LyX
187 ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MiKTeXDeliveredVersion}" "UninstallString"
188 ExecWait "$1" ; run MiKTeX's uninstaller
193 ;---------------------------------
195 Section "un.JabRef" un.SecUnJabRef
197 ${if} $JabRefInstalled == "JabRef" ; only uninstall JabRef when it was installed together with LyX
198 ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${JabRefVersion}" "UninstallString"
199 ExecWait "$1" ; run JabRef's uninstaller
204 ;---------------------------------
205 ; Section descriptions
206 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
207 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnAspell} "$(SecUnAspellDescription)"
208 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnMiKTeX} "$(SecUnMiKTeXDescription)"
209 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnJabRef} "$(SecUnJabRefDescription)"
210 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnPreferences} "$(SecUnPreferencesDescription)"
211 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnProgramFiles} "$(SecUnProgramFilesDescription)"
212 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END