I want to detect an existing installation (created with another installer) and present that as the default installation directory (for adding files to a product). The path can be found in the registry, but is complicated by the fact it could be one of four applications, so I want to try each in turn and use the first one found.
I have written this (key names are merely indicative!):
However this cannot work because you can't have StrCmp outside a function and you cant use InstallDirRegKey inside a function...
InstallDir "$PROGRAMFILES\DefaultDir"
Var /GLOBAL COMPARE
StrCpy $COMPARE $INSTDIR
InstallDirRegKey HKLM "SOFTWARE\CompanyName\Product 1" "Application Path"
StrCmp $COMPARE $INSTDIR 0 found:
InstallDirRegKey HKLM "SOFTWARE\CompanyName\Product 2" "Application Path"
StrCmp $COMPARE $INSTDIR 0 found:
InstallDirRegKey HKLM "SOFTWARE\CompanyName\Product 3" "Application Path"
StrCmp $COMPARE $INSTDIR 0 found:
InstallDirRegKey HKLM "SOFTWARE\CompanyName\Product 4" "Application Path"
:found
Any hints (or slaps for writing drivel code!) are welcome. Thanks.