I have an existing installer that installs a text file at a specific location. This file contains user settings. I have authored an upgraded installer for this initial installer. The problem is that the file gets uninstalled when I run the upgrading installer.
I wrote a simple VBSCript that runs in the:
InstallUISequence -> Begin as an attached event.
The problem is that it doesn't seem to ever run. I put in some message boxes to show and they are never shown. Also, it appears that this event even runs after the older installer is already uninstalled (thus deleting the file I need to keep).
Here is my vbscript:
Function CopySettings()
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Dim pathToAppFolder
pathToAppFolder = Session.property("AppDataFolder")
' MsgBox pathToAppFolder
Dim pathToMyApplicationFolder
pathToMyApplicationFolder = pathToAppFolder & "MyApplication\"
' MsgBox pathToMyApplicationFolder
' copy old settings if there is one during upgrade
Dim pathToSettingsFile
pathToSettingsFile = pathToMyApplicationFolder & "app.sharedsettings"
Dim pathToCopySettingsFile
pathToCopySettingsFile = pathToMyApplicationFolder & "app.sharedsettings.old"
If fso.FileExists(pathToSettingsFile) Then
MsgBox "found existing settings"
fso.CopyFile pathToSettingsFile, pathToCopySettingsFile
Else
MsgBox "shared settings file not found"
End If
MsgBox pathToSettingsFile
MsgBox pathToCopySettingsFile
End Function
Where should I put my script to ensure that is run correctly BEFORE the old installer is uninstalled?