AgentWild
Posts: 4
Joined: Mon Jul 25, 2005 4:55 pm

Having trouble, please help!

Hi there,

Despite reading lots of 'sort of related' threads on here, I cannot perform the following:

We have an existing product. I wish to check for its existance on the target computer. I check this by looking for a registry entry in HKey_Classess_Root\CLSID\{guid}\LocalServer32 which holds the location and name of an executable containing a COM class.

If there is a default value in there (and the path exists of course) then I know that the product is already installed.

If it does exist then I wish to change the TARGETDIR to the folder in which this executable is found. If it does not exist then I wish it to remain as [ProgramFilesFolder][Manufacturer]\[ProductName].

Also, if the older product does exist then I don't wish the choose-folder dialog to appear but if the older product DOES NOT exist then I DO wish the choose-folder dialog to appear.

Is this possible?
Mike
Posts: 292
Joined: Wed Jun 01, 2005 10:50 am
Location: Craiova, Romania
Contact: Website

Hi,

You can search for the default value in a certain key. For that, create a registry search. Use the [...] button to select the key. If you have selected the default key, enter the "[~]" value in the "Name" field (without the quotes).

The result for this search can then be used for setting the DEFAULTDIR property. In the "Custom Action" page use the "Show Standard Action" toolbar button to select "Before Initialization"->"Begin" option. Add on this section a "Property Set With Formatted" type of custom action.

- In the "Property Name" field enter "TARGETDIR" (without the quotes)
- In the "Formatted Text" use the [Edit] button to select your search property.
- In the "Execution Condition" filed enter the name of your search. This is evaluated to TRUE only if the search returned a non-empty string.

I'm afraid that you cannot decide at "run-time" whether to display the "Select Location" dialog. You have to decide this when you build your package.

Conclusion:
The problem is that this custom action is executed in the "Install" sequence (after the "Install" button has been pressed). This means that the user will still see the default value of TARGERDIR in the "Select Location" dialog. If the registry value is found the path entered by the user will be overwritten.

I would suggest leaving the dialog to display and informing the user (using another custom action) if the location has been overwritten .

Regards,
Mihai
Mihai Bobaru
Advanced Installer Team
http://www.advancedinstaller.com
AgentWild
Posts: 4
Joined: Mon Jul 25, 2005 4:55 pm

Thanks very much. I'd more or less done this, except for the ~ character as meaning default propert.

Is this rather strange restriction due to put on the feature list in the future?

If a registry key holds the path to a file (e.g. c:\path to a file\file.exe) then will the search you suggest allow me to easily get only the path to the file?

I guess my question is, will the 'type' if specified 'the value contains a path to a directory' automatically strip out the file and simply leave the path?

I have to say, the help file is not particuarly detailed.
ciprian
Posts: 259
Joined: Thu Jul 14, 2005 12:56 pm
Location: Craiova, Romania
Contact: Website

Hi,

In order to obtain a path to a folder from a registry value, by deleting the name of the file, here is what you should do:

Go to the "Search" page.
-Click on the "New Search" tool bar button.
-Edit the appeared property's name to the desired value.
-Right click on that property and select "Add Location"->"Registry".
-In the "Registry Location Properties" pane select the desired registry location.
-Set the value of the "Type" field to "Value contains a path to a directory" or "Value contains a path to a file"

If the search is successful the resulted property will contain the desired path.


All the best,
Ciprian
Ciprian Burca
Advanced Installer Team
http://www.advancedinstaller.com

Return to “Common Problems”