yeilam
Posts: 19
Joined: Sun Aug 13, 2006 6:22 am

Uninstall does not remove all files

Hello,
My installation creates some folders and files under <Program Files>
Then, I run the application and it changes some files ("caching").
Then, I uninstall the product but those files and their folders are not deleted.
Note that there is no problem to delete the remaining files manually, so it is not a sharing problem.
Would uninstall leave files that were changed from installation?
Is there another cause for not deleting files?
How to remove these files in uninstall?
Thanks.
Yigal
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,
Would uninstall leave files that were changed from installation?
Is there another cause for not deleting files?
How to remove these files in uninstall?
How exactly you create those files? You add them in the "Files and Folders" page or you create them with a custom action.

Also in what mode your application changes those files?

Please give me more details.

Kind Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
yeilam
Posts: 19
Joined: Sun Aug 13, 2006 6:22 am

Reading your questions I think I understand the problem:
I create the files when my application runs, so AI does not know it needs to remove them...
Should I install such files with 0 size?
Is there another way to tell uninstall to remove them, or better: the whole folder?
Thanks!
Yigal
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi Yigal,

The only way to delete the folder is through a custom action with a script. Here is an example of such a script:

Code: Select all

Function removeInstallDir()
   Dim pathToFolder, smallPath
   Set objFS = CreateObject("Scripting.FileSystemObject")
   pathToFolder = Session.property("APPDIR") 'the folder you want to remove (install dir)
   smallPath=Left(pathToFolder,Len(pathToFolder)-1)
   If (objFS.FolderExists(smallPath)) then
      objFS.DeleteFolder smallPath, true
   End if
End Function
You can schedule this custom action under "InstallExecuteSequence->RemoveFolders" with (REMOVE="ALL") as execution condition.

Hope this helps.

Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
Stella
Posts: 20
Joined: Thu Oct 05, 2006 4:33 pm

Hi gigi,

I have exactly the same problem as Yigal had, my application creates some files that AI obviously doesn't know it has to remove. I've been trying to implement the solution you gave him, but I am unsure on how to do it. What type of custom action do I need to create under RemoveFolders? I tried creating a "script inline", but I'm not sure whether that is the right type, and, if it is, what to set in the different fields in the "General Properties" section. Could you give me a little bit more information?

Thanks in advance,

Stella
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi Stella,

Copy that code to a .vbs file switch to "Custom Actions" page and add a new "New Attached Custom Action" under "InstallExecuteSequence->RemoveFolders" with (REMOVE="ALL") as execution condition, "Deferred" as execution condition, removeInstallDir in the "Function Name".

Let me know if you encounter any problem.

Best Regards,
Gigi
_______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
Stella
Posts: 20
Joined: Thu Oct 05, 2006 4:33 pm

Hi gigi,

That works ok, thank you very much. My problem now is that we used this installer as part of an automated process, and we would need it to pick up the vb script file that is sitting next to it, independently of where the file is located. Is there any way to do that?

Thanks very much for your quick replies!

Stella
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi Stella,
My problem now is that we used this installer as part of an automated process, and we would need it to pick up the vb script file that is sitting next to it, independently of where the file is located. Is there any way to do that?
I'm not sure if I understand correctly what you want to say. You want to execute a VB script how resides next to your MSI file?

If this is the case then use a "Add Predefined Custom Action->Launch File or Open Url" type of custom action. In the "Command Line" field type: "[SourceDir]\file.vbs" (where [SourceDir] property gives the path where the msi resides).

If this is not what you want then please give me more details.

Best Regards,
Gigi
_______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
Stella
Posts: 20
Joined: Thu Oct 05, 2006 4:33 pm

Hi gigi,

What I want to do is exactly what you suggested in your previous post: have a custom action in a vb script to make the installer remove all files under the application folder. The problem is that, when creating the custom action, I need to give Advanced Installer the absolute path to the file containing that script. I was wondering if there is any way to just give a path relative to the .aip project file, so that we could build the installer no matter where the .aip file sits, as long as the vb script is in the same folder.

Hope this makes sense,

Stella
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi Stella,

This is depending on what option (Paths type absolute or relative) you have selected in the "Edit Project Settings" dialog ("Project->Options" main menu).

Best Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
Stella
Posts: 20
Joined: Thu Oct 05, 2006 4:33 pm

Hi gigi,
My project is set to use relative paths, but I don't seem to be able to give AI the relative path to the VB script.

Anyway, we found a workaround for that, and it is now working.
Thanks for your help!
Stella
joncrlsn
Posts: 4
Joined: Fri Jan 12, 2007 11:02 pm

InstallExecuteSequence->RemoveFolders

Hi Gigi, Thanks for your VBS example. I never would have come up with that on my own.

My question is though, you keep talking about a RemoveFolders under InstallExecuteSequence. I don't have anything like that on my UI.

I do have an Uninstall folder under InstallExecuteSequence. I tried it there and it didn't seem to work. Can you help me?

I'm using the latest AI: 4.6.4

Thanks!
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

Advanced Installer hides standard actions if they don't have custom action scheduled under them. To make a standard action visible use "Show Standard Action" toolbar menu from the "Custom Actions" page.

If you encounter any problems using AI please let me know.

Best Regards,
Gigi
______________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
joncrlsn
Posts: 4
Joined: Fri Jan 12, 2007 11:02 pm

Script error

Thanks so much for your help. As you can tell, I'm rather new to AI and VBS scripts.

I've done everything you said, however, I'm getting a script error on uninstall now. I'm wondering if I have to do something to set the APPDIR system variable in the script. I would think that would be set automatically, but maybe not.

If setting APPDIR correctly is not the answer, then how would I go about viewing the uninstall logs or executing the script from the command-line to make sure the vbs file is correct.

Sorry for questions that are probably obvious to everyone else!

- Jon
joncrlsn
Posts: 4
Joined: Fri Jan 12, 2007 11:02 pm

Session.property("APPDIR") is empty

I'm sure I'm just missing something, but I learned enough VBScript today to find out that Session.property("APPDIR") is empty in the Attached Custom Action I'm using (RemoveInstallDir). It doesn't seem obvious to me how to set this for the script, and I've been looking most of the day.

Any help would be much appreciated!

- Jon

Return to “Common Problems”