- NSIS Discussion
- How can I uninstall and install again with multi language
Archive: How can I uninstall and install again with multi language
sunlight112
7th November 2006 09:31 UTC
How can I uninstall and install again with multi language
After finishing install with multi language,I want to check my software is installed or not on computer if user install is again.If is installed, I will uninstall and run new version. I search and see on Wiki . In my installer, I work with many language. If I put it on Init, I can not display many languages which I allow user choose. I think uninstall is finished, id of every language is stored and run my application with the same language which I installed in old version. I put function on this link above on function to call them. But I can not know where I can put it.
Function Remove
ReadRegStr $R0 HKLM \
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"UninstallString"
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${PRODUCT_NAME} is already installed. $\n$\nClick `OK` to remove the \
previous version or `Cancel` to cancel this upgrade." \
IDOK uninst
Abort
;Run the uninstaller
uninst:
ClearErrors
Exec '$R0' ;Do not copy the uninstaller to a temp file
IfErrors no_remove_uninstaller
no_remove_uninstaller:
done:
FunctionEnd
Please help me!
My word is very bad, If you do not clear, please tell me!!!
Thank a million!
:p
sunlight112
8th November 2006 01:18 UTC
If someone used to see this problem, please help me!!!
Your help is very useful for me!
Thank a lot!
sunlight112
8th November 2006 06:25 UTC
I want to make clearly about my idea.
After I install my software, user continue to install my application to update. I must ask them to uninstall old version and install new one.
My problem is here:
When user uninstall my program, install program will execute. Because my program use with multi languages. The process install to continue but it does not allow for user to choose language which they want to install.
I try my best to solve but I can not.
I need your help too much if you can show me some solutions.
Thank a lot,
sunlight112
8th November 2006 07:27 UTC
Actually, I do not know exactly where I can put functionCall remove.If I put it here, I can not display multi language. However, I do not put it there, I can check old version.
Function .onInit
Call Remove
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
Function Remove
ReadRegStr $R0 HKLM \
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"UninstallString"
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${PRODUCT_NAME} is already installed. $\n$\nClick `OK` to remove the \
previous version or `Cancel` to cancel this upgrade." \
IDOK uninst
Abort
;Run the uninstaller
uninst:
ClearErrors
Exec '$R0' ;Do not copy the uninstaller to a temp file
IfErrors no_remove_uninstaller
;You can either use Delete /REBOOTOK in the uninstaller or add some code
;here to remove the uninstaller. Use a registry key to check
;whether the user has chosen to uninstall. If you are using an uninstaller
;components page, make sure all sections are uninstalled.
no_remove_uninstaller:
done:
FunctionEnd
[/SIZE]
Please help me!!!
bholliger
8th November 2006 08:50 UTC
Hi sunlight112!
I'm really sorry, I've been reading your post twice, but I'm sure, I haven't understand.
I suggest moving the LangDll-Dialog in front. Why is this a problem for you?
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
Call Remove
FunctionEnd
First the installer ask for the language and checks for an existing installation.
Cheers
Bruno
sunlight112
8th November 2006 10:59 UTC
Thank bholliger for your reply,
I am so sorry about it.
My problem is : If old program is installed. I want to uninstall old version before I install new version.
After I finish uninstalling old version, my new program will execute. But my application is installed with multilanguage. If means it allows user to choose many language to install.
At that time, after uninstall successful, the page welcome is displayed with the same language which I choose to install in old version.
I only want to know how can I allow user to choose language to install after uninstalling old program.
My code here:
Function .onInit
Call Remove
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
Function Remove
ReadRegStr $R0 HKLM \
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"UninstallString"
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${PRODUCT_NAME} is already installed. $\n$\nClick `OK` to remove the \
previous version or `Cancel` to cancel this upgrade." \
IDOK uninst
Abort
;Run the uninstaller
uninst:
ClearErrors
Exec '$R0' ;Do not copy the uninstaller to a temp file
IfErrors no_remove_uninstaller
;You can either use Delete /REBOOTOK in the uninstaller or add some code
;here to remove the uninstaller. Use a registry key to check
;whether the user has chosen to uninstall. If you are using an uninstaller
;components page, make sure all sections are uninstalled.
no_remove_uninstaller:
done:
FunctionEnd
I also try put my code above and under
!insertmacro MUI_LANGDLL_DISPLAYto display many languages for user choose to install.
I try all my word to explain, if you do not know, I will try it again
Thank you for your help,
glory_man
8th November 2006 15:36 UTC
Check your uninstaller. If there is no code to delete registry language settings -> language selection dialog will not show.
bholliger
8th November 2006 20:21 UTC
Hi sunlight112!
Ah, I guess I'm aware of the problem now. This might help you: Define MUI_LANGDLL_ALWAYSSHOW in your script.
!define MUI_LANGDLL_ALWAYSSHOW
If you set this constant, the dialog will always show, no matter what setting has been saved before.
Furter information:
http://nsis.sourceforge.net/Docs/Mod...UI/Readme.html
Search for MUI_LANGDLL_ALWAYSSHOW
Cheers
Bruno
sunlight112
9th November 2006 01:27 UTC
Thank glory_man and bholliger very much,
Now I can do it well. However, I have one question on this field.
When I run my application, (in case my application is installed already) MessageBox will display to ask user to uninstall old version.
After user click OK(it means uninstall it). A screen allow user choose language to install new version is appeared and follow it is Uninstall old version is displayed.
I am worry if user click CANCEL on Uninstall program. The screen chooses language still allow user to install new version(it does not hide when uninstall program is click CANCEL). At that time, user do not need to unintall old version and can continue to install new version although I check it before installing new version.
How can I check if user click CANCEL on Uninstall screen? I do not allow them to install new version.
I am sorry about my word.If you do not know, please tell me!
Thank a lot,
bholliger
9th November 2006 01:34 UTC
Hi sunlight112!
I'm not sure if you can use /S with the uninstaller. Can you try this?
ExecWait '$R0 /S _?=$INSTDIR'
Cheers
Bruno
sunlight112
9th November 2006 03:15 UTC
Thank bholliger a lot,
Bholliger posted:
ExecWait '$R0 /S _?=$INSTDIR'
Can you explain your code? I do not understand why we should use this.
I also try with your code. Your code work well with my idea but it just deletes file " *test.exe, website.link and registry"and not delete my "uninst.exe".And, it also does not display screen uninstall(I know it because uninst.exe is not called)
Can you tell me why "uninst.exe" is not deleted?
I also try with this code:
ExecWait '$R0 _?=$INSTDIR'
The result is the same your code.
Thank you very much for your help,
bholliger
9th November 2006 06:08 UTC
Hi sunlight112!
The uninstaller is called and executed with ExecWait, this causes the installer to wait until the uninstall is finished. It is called with the uninstall directory, so there's no need to ask for a directory and the uninstall process is performed silently in the background. Because of the fact the installer is overwritten anyway during your upcoming install, there's no need to remove the uninst.exe (Have a look at the wiki [1], the behaviour is explained there).
In the end you have what you requested: The user is not able to cancel the uninstall process. Voila!
Cheers
Bruno
[1] http://nsis.sourceforge.net/Auto-uni...installing_new
sunlight112
9th November 2006 07:51 UTC
Thank bholliger a lot,
Now I can understand it clearly :)
Thank you so much,
bholliger
9th November 2006 07:56 UTC
You're welcome!
peeratep
12th March 2007 08:18 UTC
continue install
i want continue install after uninstall successfuly!