PDA

View Full Version : Revised problem with changing Installdir



IanBrooke
04-12-2012, 02:36 PM
I posted earlier a problem with changing Installdir. Further checks have shown that post to be inaccurate so I deleted it and here's a new one! :o

We have an install which is using a custom action to run a vbscript which may change the Installdir to a new value from a registry key. If the key exists it points to an existing folder of an earlier installation and I need to overwrite files in that folder, otherwise I install in ProgramFilesFolder/appname. The custom action runs "After Install Welcome dialog"

When it runs, the vbscript finds the registry key and seems to set appdir properly as the Destination Folder Dialog correctly shows the path from the registry key. However the files which are supposed to overwrite those in sub-folders don't get installed, instead they are installed in the default ProgramFilesFolder (which it wrongly creates), the exe however seems to be going into the correct folder (from the registry key) which is totally crazy. All the files are set to "always overwrite" and I really cannot figure out what is going on. :eek:

What I did then however is to run the install up to the select Destination Folder screen. This still shows the correct folder (from the registry key) but instead of just accepting that value I use that screen's 'choose' button to navigate to the same folder, then click next and finish the install, everything then works properly. The Programfilesfolder is correctly not created and all the files go into the correct place in my existing folder.

So am I setting Installdir properly or not, am I running it in the right point in the install, but if it's wrong, why does the Destination Dialog show the path that I am setting with the script??? :confused:

here's the script....
Function CheckKey()

Dim objShell
Dim key, x

key="HKCU\Software\VB and VBA Program Settings\myappname\Startup\AppPath"

On Error Resume Next
Set objShell = CreateObject("WScript.Shell")
x=objShell.RegRead(key)
Set objShell = Nothing
If Err = 0 Then
Session.Property("INSTALLDIR") = x & "\"
Else
Err.Clear
End If

End Function

All ideas VERY welcome

CHANDINATHREDDY
04-26-2012, 07:38 AM
verify wether the files and folders view pane the files are set to install in install directory if there is an mismatch between them i mean if they are hard coded then we can see such problem one way is first set the installdir property to the property that is returned by your vbs,and next set that file install location to the installdir in files and folders pane..one thing make sure that the install dir property and the folders and file install location match.

sorry if i could not present the sollution right way.