|
|
|
|
#1 |
|
Junior Member
Join Date: Jul 2003
Location: USA
Posts: 34
|
autouninstall
I have my autouninstall...but when Im running the autouninstaller there is the install window behind him ready.
I want to start the new installation only if is unistalled the old program and stop the installation (new program), if they dont accept the upgrade/cancell. Thank you ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROD_NAME}" "uninstallstring" StrCmp $1 "" cont StrCmp $0 "" done cont: HideWindow MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \ "This wizard will autouninstall the ${PROD_NAME}. $\n$\nIt is strongly recommended that you uninstall manually any previous versions of \ ${PROD_NAME} 2.5.${VER_MINOR}$\n$\nClick `OK` to install or `Cancel` to cancel this upgrade." \ IDOK uninst Abort uninst: ClearErrors ExecWait '"$INSTDIR\uninstall.exe" /S_?=$INSTDIR' done: BringToFront |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
If you want to close the installer that runs the uninstaller, use
Exec '"$INSTDIR\uninstall.exe" /S_?=$INSTDIR' Quit You could pass a command-line parameter to the uninstaller to be read in the uninstaller to re-run the installer when the uninstall is complete. E.g. In installer .onInit Exec '"$INSTDIR\uninstall.exe" /S_?=$INSTDIR yes' Quit In uninstaller Section Uninstall ... Call GetParameters Pop $R0 StrCmp $R0 "/S_?=$INSTDIR yes" 0 noQuit Exec installer.exe Quit noQuit: SectionEnd -Stu |
|
|
|
|
|
#3 |
|
NSIS MUI Dev
Join Date: Nov 2001
Posts: 3,717
|
You'd better send the filename of the installer, because the user might have renamed the file.
See http://nsis.sourceforge.net/archive/...b.php?page=427 |
|
|
|
|
|
#4 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Ah yes!
Thinking about it now, it's probably easier to write the extra parameters to a temp ini file or to the registry, so that a string function isn't required to get hold of the sent command-line parameters. E.g. In installer .onInit Call GetEXEName Pop $R0 WriteINIStr "$TEMP\myinstaller.tmp" "Installer" "InstallerEXE" "$EXEDIR\$R0" Exec '"$INSTDIR\uninstall.exe" /S_?=$INSTDIR' Quit In uninstaller Section Uninstall ... IfFileExists "$TEMP\myinstaller.tmp" 0 noQuit ReadINIStr $R0 "$TEMP\myinstaller.tmp" "Installer" "InstallerEXE" Exec "$R0" Delete "$TEMP\myinstaller.tmp" Quit noQuit: SectionEnd |
|
|
|
|
|
#5 |
|
NSIS MUI Dev
Join Date: Nov 2001
Posts: 3,717
|
I think using the command line is a good solution.
|
|
|
|
|
|
#6 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
A simpler solution would be reading the uninstaller's return value. As stated in C.2 Error Levels, the uninstaller will return 1 if the process failed. Read it using the second parameter of ExecWait. For example:
ExecWait '"$INSTDIR\uninstall.exe" _?=$INSTDIR' $0 StrCmp $0 0 goodToGo Abort goodToGo: BTW, you have an error in your call to the uninstaller. It seems as you've tried to make the uninstaller silent but missed a space after the /S parameter. I have removed it in my example because you've talked about the user clicking the cancel button, which is impossible if the uninstaller is silent. NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#7 |
|
NSIS MUI Dev
Join Date: Nov 2001
Posts: 3,717
|
But in that case the installer keeps running. The command line is used to send the installer filename.
|
|
|
|
|
|
#8 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
The installer should wait for the uninstaller if using _?=$INSTDIR on the command line.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#9 |
|
NSIS MUI Dev
Join Date: Nov 2001
Posts: 3,717
|
Yes, but it keeps running. It's nicer to close it until the uninstallation has completed.
|
|
|
|
|
|
#10 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
HideWindow takes care of that, it shouldn't even show on the taskbar. And if this is used in .onInit, there is nothing to worry about anyway.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#11 |
|
Junior Member
Join Date: Jul 2003
Location: USA
Posts: 34
|
I never had a moment to try your script "help".
But thank you ....I'll let you know when I have free time. |
|
|
|
|
|
#12 |
|
Junior Member
Join Date: Jul 2003
Location: USA
Posts: 34
|
I tried your script and I have in thefollowing problem:
this is my script MUI_STARTMENUPAGE_DEFAULTFOLDER "${PROD_NAME}" and I have the name of the "OutFile" myinstaller1122.ex be carefull no all name of the outfile ....missing letter e. So far..this is working great if the users dont change the name of the installer: ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROD_NAME}" "uninstallstring" StrCmp $1 "" cont StrCmp $0 "" done cont: HideWindow MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \ "This wizard will autouninstall the ${PROD_NAME}. $\n$\nIt is strongly recommended that you uninstall manually any previous versions of \ ${PROD_NAME} 2.5.${VER_MINOR}$\n$\nClick `OK` to install or `Cancel` to cancel this upgrade." \ IDOK uninst Abort uninst: ClearErrors ExecWait '"$INSTDIR\uninstall.exe" _?=$INSTDIR' $0 StrCmp $0 0 goodToGo Abort goodToGo: done: BringToFront I have two choices : -First: the users are unable to change the name. -Second: find to do exactly what we want (best choice). |
|
|
|
|
|
#13 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
What does the name of the installer has to do with this? You don't execute it. What exactly do you mean by "find to do exactly what we want (best choice)."?
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#14 |
|
Junior Member
Join Date: Jul 2003
Location: USA
Posts: 34
|
I used Afrow Uk script and I have the name of the installer myinstaller1122.ex("OutFile") and there I need my ${PROD_NAME}
MUI_STARTMENUPAGE_DEFAULTFOLDER "${PROD_NAME}" And what I mean "about" find to do exactly what we want (best choice). is to allow the users to change the name of the installer and autouninstall it. But I found another problem: if the users changed the name of the previous version the new installer (with autouninstall) doesnt work. Probably the best way is not to allow to change the name. |
|
|
|
|
|
#15 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
You don't need Afrow's functions anymore. The code in your last post should be enough.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#16 |
|
Junior Member
Join Date: Jul 2003
Location: USA
Posts: 34
|
Thank you Kichik im thinking to use your code...is great.
And going to "not allow to change the name" |
|
|
|
|
|
#17 |
|
Junior Member
Join Date: Jul 2003
Location: USA
Posts: 34
|
Btw I forgot to tell you ...I wrote that error on the Afrow UK on my installer to try to fix or see if is only a my problem.
I resolved my problem , with your script , but the forum is for all people no just for my script. Thank you again for your patience. |
|
|
|
|
|
#18 |
|
Junior Member
Join Date: Jul 2003
Location: USA
Posts: 34
|
Sorry Im back again....the autouninstaller was always triggered
even if no prior version of the program was installed. |
|
|
|
|
|
#19 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
Please attach the entire script.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
|
|
#20 |
|
Junior Member
Join Date: Jul 2003
Location: USA
Posts: 34
|
Thank you shoot the file....
|
|
|
|
|
|
#21 |
|
Junior Member
Join Date: Jul 2003
Location: USA
Posts: 34
|
|
|
|
|
|
|
#22 |
|
M.I.A.
[NSIS Dev, Mod] Join Date: Oct 2001
Location: Israel
Posts: 11,343
|
There is no place in the script where you actually write to HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PROD_NAME}" "UninstallString". If you don't write anything there, the script won't be able to read anything from there. You should also write this key so your uninstaller would be listed in the Add/Remove control panel. See Appendix C - "Add uninstall information to Add/Remove Programs" for more information.
NSIS FAQ | NSIS Home Page | Donate $ "I hear and I forget. I see and I remember. I do and I understand." -- Confucius |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|