PDA

View Full Version : help deleting files at the end of installation



GBerlonghi
12-08-2005, 12:52 PM
Hey everyone. I'm extremely new to using IS, but im finding it is quite nice. One thing I wanted to know is how I could delete certain files after they have been used for the installation. Basically our product requires the installation of several third party drivers for security keys, usb drives etc. I have the files included with the installation, and put in a sub-directory of the main installation files. I've created Custom Actions to run the files after the main product has been installed, and they install in the correct order. What I'm looking for is a way to delete the installers for these drivers after they have been used.

After reviewing alot of the documentation I found the RemoveFile Table, but is that used for Uninstall purposes? Or is that exactly what I'm looking for? If so, how exactly would I go about setting that up? I also though about using a Custom Action VBScript, but im not too familiar with VBScript and am uncertain how I would go about making sure the correct files were deleted since the installation path could vary from customer to customer.

If anyone could help me with either of these solutions, or if there is a better way, it would be very much appreciated.

Cheers,

Gabe

Ryan A
12-08-2005, 01:32 PM
I think your best bet would probably be to delete the files with InstallScript in the either the OnFirstUIAfter event or the OnRebooted event. There's a DeleteFile method in InstallScript you can use to delete them. If they get installed by your app though they will probably be reinstalled by a Repair, so you may need to account for that also. If you're not already doing so you may be better off adding them as support files on the CD and running them straight from there.

Ryan

davech66
12-08-2005, 01:59 PM
in case you are not using installshield script project, you can use vbscript to delete folder/ file.
for example, to delete file, use something like below:

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile filespec, True

set fso=Nothing

GBerlonghi
12-08-2005, 02:19 PM
If i make them support files, they automatically get run? Or I still need the custom actions to run them, but they get deleted at the end of the installation?

Also, forgive me for the simplistic questions, but in the custom actions what is the difference between "Install UI Sequence" and "Install Exec Sequence"? I'm assuming that Exec runs the files in the background, whereas UI brings up the user dialog. Is that correct? If so, is there any indication of the files being successfully installed in Exec mode?

As I said I am extremely new to this(day 2 ;o) and really need a crash course to get everything finished quickly. Thanks for your help.

KathyMorey
12-09-2005, 09:04 AM
First, if you install the files, then delete them (however you do that) you may trigger the auto repair function. (I found this out the hard way!)

Do the files have to be in your program path to run? If you can run them from a temp directory, you might try putting them in the Support Files and running them from there with a custom action in a dll or VBScript. They will automatically be removed at the end of the installation as part of clean up, and you won't have to worry about auto repair.

As for the UI and Execute sequence, I think you really need to take the time to read the doc on how basic MSIs work; it will save you a lot of problems later. :)