snigel
Posts: 4
Joined: Tue Mar 08, 2005 10:28 pm

Setting default installation path

Hello!
I have a question about changing the default installation path depending on if a registry key exists or not. I'm installing a plugin for a program and therefore need to check if that program already exists on the computer and if so: where.
What I do is first look for a certain key (containing the installed program path) and retreive it's value by using the "search" option and saving the result in a a variable, lets call it GETINSTALLDIR.
Second, I'm changing the Application Folder to [GETINSTALLDIR]. This results in setting the installation directory correct, but only if the program is installed. And here is the problem. If the program is not installed the installation directory should be set to a default path (eg. "C:\Programs\MyApp"). How can I do this?

Thanks!
/Nigel
Cata
Posts: 638
Joined: Thu Apr 10, 2003 7:37 am
Contact: Website

In Install Parameters set the application folder to the default you want and use a custom action to set the the Application Folder (TARGETDIR) to the value retrived from registry AND set a condition to this custom action.

The condition is the name of the property set by the search - which resolves to true if the property is set - the search succeedded , or to false if the search failed.

Schedule this custom action after InstallInitialize standard action.
Catalin Rotaru - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
snigel
Posts: 4
Joined: Tue Mar 08, 2005 10:28 pm

Okay.. I've tried it but haven't got it to work. Here's what I do:

Image
I set the default path...


Image
...create a search...


Image
...and then finally make a custom action under InstallInitialize.


But the result is that the Custom Action doesn't seem to run at all. Because when I get the "install path" dialog in the installer it's still the default value (eg. "[ProgramFilesFolder]\MMFusion")
I'm using the latest version of your installer product. How can I fix this?
snigel
Posts: 4
Joined: Tue Mar 08, 2005 10:28 pm

Well... any idea what I do wrong?

/Nigel
dorel
Posts: 25
Joined: Mon Oct 18, 2004 8:13 am

Hi Nigel,
The condition on the custom action must be "GETINSTALLDIR"-no quotes -only the name of the property.
Dorel Pislan
Advanced Installer Team
http://www.advancedinstaller.com
snigel
Posts: 4
Joined: Tue Mar 08, 2005 10:28 pm

Ok. But the condition still doesn't seem to be the actual problem. Even if I remove it TARGETDIR never gets set to GETINSTALLDIR. It's just so weird..

Return to “Common Problems”