We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

ucramos
Posts: 16
Joined: Wed Jan 15, 2014 9:57 pm

Define default install folder from Search

I made a program that is a add-on to another program, so it needs to be installed on the same folder as the "master" program.
That program does not have a specific entry on Registry where the installation folder is located, so i have 2 solutions:

1- I can search the exe file, for example c:\program\editor\program.exe
But when i try to use the property defined on CUSTOM BEHAVIOR -> SEARCH in PRODUCT INFORMATIOn -> INSTALL PARAMETERS -> APPLICATION FOLDER, i get on the installer text box "c:\program\editor\program.exe"
I would need some way to strip the "program.exe" from the search to be able to use it


2 The master program has 2 keys with "uninstall" info. One for x86 and another to x64.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1EAC1D02-C6AC-4FA6-9A44-96258C37C812EU}_is1
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{1EAC1D02-C6AC-4FA6-9A44-96258C37C812EU}_is1

I can retrieve these 2 with a search, but i would need some way to do a "if operation system is x86 use [FOLDER_X86], if operation system is x64 use [FOLDER_X64].

can you please help me?
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Define default install folder from Search

Hello and welcome to Advanced Installer forums,

In order to achieve that you can use your own custom action that retrieve the path C:\program\editor from C:\program\editor\program.exe.

Then you can go in the “Custom Actions” page and add a predefined Launch attached file custom action with sequence. This type of custom action can execute an application (EXE or DLL) or run a script (VBScript or Java script). Also, the source file will be embedded in the MSI file but will not be deployed at install time with the other application files.

Please note that I used the predefined Execute inline script code custom action with sequence added after the Searches from the Install Execution Stage and I manage to get the folder path where that file was installed.

Code: Select all

 Session.Property("FLD_PTH") = Left(Session.Property("FILE_PTH"), InStrRev(Session.Property("FILE_PTH"), "\")-1)
where:
  • FLD_PTH is a public property that will contain the folder path
    FILE_PTH is the property assigned to the file search operation in the Search page and contains the C:\program\editor\program.exe value.
Then you can go in the Files and Folders page and add a Property based folder using the FLD_PTH property. Property based folders will be resolved at install time to the values from the respective property.

Please let us know if that helped.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ucramos
Posts: 16
Joined: Wed Jan 15, 2014 9:57 pm

Re: Define default install folder from Search

Thank you for your quick reply.

I couldn`t figure out the steps you explan.
Maybe i explained myself wrong.

I have some script files that need to be installed on the same folder as the "master" program for them to work
On my installation i have the default install path of that program defined on "Install Parameters"
However the person or even the operation system can change that default installation folder, and if the person does not change it to the correct one, the scripts will not work.

I want a way to "detect" where the program is located and "paste" that folder on the installer "path box"

I can search for the exe file but as i explained before i need to strip the "exe file" from the path, or by using the uninstall registry.

I can get the registry to work, but the uninstall info has variants. One on x86 systems and another one for x64.
They work by themselves. If i run a x86 windowa on vmware and use the "x86 registry search" i get the correct result. If i use a x64 i get "c:\aapdir"
I would need a way to make a condition like "if condition 1 is null then run condition 2" or something like this.

I think the "search for the file and strip down the exe" method is easier, but maybe the uninstall method be more reliable as it uses the unique ID of the program

Sorry if i´m missing something or some step.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Define default install folder from Search

Hello,
I can search for the exe file but as i explained before i need to strip the "exe file" from the path
You can go in the Custom Actions page and add the predefined Execute inline script code custom action with sequence and use my code from my previous reply( Session.Property("FLD_PTH") = Left(Session.Property("FILE_PTH"), InStrRev(Session.Property("FILE_PTH"), "\")-1)).

You can use this property FLD_PTH for a Property based folders. So, if your search (named in my example FILE_PTH ) will contain the following value: C:\program\editor\program.exe, then the FLD_PTH will contain the following value: C:\program\editor
You can also take a look on the How do I install files in a custom folder article which may be useful.

While for the registry search I'm not sure I fully understand your scenario. Can you please give me a detailed test case scenario?
Maybe this forum debate can help you: Can't find registry key.

Please let us know if that helped.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”