Archive: Installer


Installer
I'm just curious about something.

Is there anyway to execute another program
and wait for it to finish, before you can
close the installer? Say I have test.exe
that is being installed, and once it's been
installed, I want to run it in the background
and wait for it to finish before you can close the installer.

Is there any possible way you can do that?

Thanks,

runik


Use ExecWait


Ok, thanks.

One more thing. With the uninstall, is there anyway to delete everything that is in the folder without having to put


Delete "$INSTDIR\myapp.exe"
Delete "$INSTDIR\myapp.ini"

ect..

The reason I ask, is because my application downloads files off the web and they change all the time. So before I release it I don't now what files the program will have to download for future updates.

I hope I made that clear, to where you can understand what I'm wanting to do.

Thanks again,

runik

you mean you want to delete the files in the $INSTDIR and then remove the dir after wards? you can just use RMDir /r $INSTDIR and it will recursivly delete everything inside the dir and then delete $INSTDIR


As Schultz pointed out, you can use RMDir /r.
Additionally, with the new NSIS you can use the FindFirst, FindNext routines to search a directory structure for each file. This would come in handy if you have some way of determining which files are yours and which you want to delete, or if there are specific files which you want to leave behind.
Otherwise, just use RMDir and make sure that whatever directory you delete doesn't have other files in it.


Delete $INSTDIR\*.* deletes all files ;)

-Justin


Originally posted by Schultz
you mean you want to delete the files in the $INSTDIR and then remove the dir after wards? you can just use RMDir /r $INSTDIR and it will recursivly delete everything inside the dir and then delete $INSTDIR
Only problem here is if some user is stupid enough to install your program to just "C:\program files\", or even "c:\", which does happen :) . I'd reccomend doing it the slow way for safety's sake

Sorry, I just read the reasons for your question properly there :). Maybe downloading some sort of uninstall.ini and reading the filenames to delete from it would be a better idea


Originally posted by prodangle


Only problem here is if some user is stupid enough to install your program to just "C:\program files\", or even "c:\", which does happen :) . I'd reccomend doing it the slow way for safety's sake
Very good point.. i never thought about that.. and yes there are alot of stupid users out there sometimes.. i think i will update my scripts now to reflect this.

Thanks for the help guys. And thanks prodangle for pointing that out. That could get ugly if they installed to system folder or something.


thanks agian,

runik


Well, you could do it this way. Every update or install package you create a new uninstall.exe, replacing the old one. So, try it like this:

I have my program installer:


Name MyApp
OutFile myapp.exe
;insert installer info here
;
;
;
;
;
;
;
;
;
UninstallExeName uninstall.exe
;Do a regular uninstall, just uninstalling the installed components


Now for packages that DON'T come with the program installer:

Name MyAppPlugins1
OutFile package1.exe
;install the components
;
;
;
;
;
;
;
;
;
;
Section -post
;in the post section, delete the current uninstall.exe
Delete /r $INSTDIR\uninstall.exe
;If you need some post installation stuff, do it here
SectionEnd

;Now, Recreate the uninstall.exe
UninstallExeName uninstall.exe
; now search for the files from other possible packages using
; IfFileExists
IfFileExists $INSTDIR\Plug-ins\package2.dll 0 Nopackage2
Delete /r $INSTDIR\Plug-ins\package2.dll
Nopackage2:
; Continue to do this for other packages and also delete the actual
; program files as well.

This can also be used for Updating.

The only problem with this is that once a new package is introduced, you have to update the other older packages to delete it if, lets say, a user installs a Package 7, then installs a package 2 AFTER the 7th package.

But this will work.

-Duane

Hey, thanks man. I'll give it a try.

runik