Locate file 4 level deep without search of Depth 4 - Advanced Installer Community
Witanca
Posts: 13
Joined: Sun Jun 01, 2014 6:21 pm

Locate file 4 level deep without search of Depth 4

Advanced Installer 11.2
Requirments > Launch Conditions > Custom

Question:
How to locate a .exe file in a 4 level deep folder structure?

F:\A\B\C\D\X.exe

I have a REG-Key with the following result > ( F:\A\ )

But how do I go from there?

NOTE:
1# Setting the “Depth” setting to 4 will result in a really long search time.

2# Setting “Path” setting to [REGISTERPATH]B\C\D\ does not work.
Witanca
Posts: 13
Joined: Sun Jun 01, 2014 6:21 pm

Re: Locate file 4 level deep without search of Depth 4

I really could use some help with this.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Locate file 4 level deep without search of Depth 4

Hello,

In order to achieve this you can add a "file search" (e.g. MY_FILE) on Search page to search for the "X.exe" file (just add "X.exe" file in the "Name" filed from "File To Search" right pane). Then, select your file search associated property (i.e. MY_FILE) and from the context menu choose "Add Location -> Folder"). In the "Directory Properties" right pane set the following:
  • Path:
    Depth: 4
In this way the file will be searched on all drives using the above depth. However, considering the depth value, as you already noticed this search could take a substantial period of time.

Also, as another option, you can create your own custom action which will get the related path from the registry value and put it into an installer property (e.g. REGISTERPATH). Then, you should add a file search which will look for the file in the following location:

Code: Select all

[REGISTERPATH]B\C\D\
The custom action should be added before "Searches" action group. You should proceed like this because you cannot add another registry search into "Search" page. All searches from "Search" page are executed randomly at install time, therefore you cannot add a registry search in "Search" page whose associated installer property to be used inside another search.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Witanca
Posts: 13
Joined: Sun Jun 01, 2014 6:21 pm

Re: Locate file 4 level deep without search of Depth 4

That’s not good to hear.

If;

- Stacking search results from other searches (Not Posible)
- Searches are preformed in random order (Not Posible)

Then its simply not posible what I try to do. I need both functions as discribed above to be preformed. Otherwise I can not check for already installed files.

Preforming a system wide search with the depth of 4 or even higher is out of the question.

I would really like to request something like this for next version of the Advanced Installer.
- Searches to be preformed in a fixed / by user set order
- Stacking search results from other searches

Will try to see if creating "Custom Action's" would do the trick, back on that later.
Witanca
Posts: 13
Joined: Sun Jun 01, 2014 6:21 pm

Re: Locate file 4 level deep without search of Depth 4

Advanced Installer 11.2
- Custom Behavior > Search

Quote:
Windows Installer allows you to search for a file, component, registry key, folder or INI key on the target computer. The result of your search will be placed in a Property and it can be used in various Custom Actions or Conditions.

* Search for registry key > [REGISTERPATH] > Register Key Value => ( F:\A\ )

Question:
How does one build a “Custom Action or Condition” based on a “Property” generated by a Windows Installer search result.

Think it should look like this:

* Search for a folder > [FILEPATH] > [REGISTERPATH]B\C\D => F:\A\B\C\D

* Search for a file > [FILE] > [FILEPATH]X.exe => F:\A\B\C\D\X.exe

I have no idea on how to proceed at this point.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Locate file 4 level deep without search of Depth 4

Hello,
I would really like to request something like this for next version of the Advanced Installer.
- Searches to be preformed in a fixed / by user set order
- Stacking search results from other searches
Our "Search" page uses the default Windows Installer search support and this is a Windows Installer limitation (searches are executed randomly). However, I've added your request on our TODO list and maybe it will be available in a future version of Advanced Installer, thank you for your suggestion.
How does one build a “Custom Action or Condition” based on a “Property” generated by a Windows Installer search result.
I'm not sure I fully understand what you mean, but if you are asking about how to access a Windows Installer property within a custom action code, then you can take a look on the following links which should be useful for you:
- C++ custom action
- C# DTF custom action
- VBS custom action

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Witanca
Posts: 13
Joined: Sun Jun 01, 2014 6:21 pm

Re: Locate file 4 level deep without search of Depth 4

I finaly found a work around for the problem I am having, its not a full proof sollution but it will do for now.

On the other hand I think, I start to understand how the “Search” and “Launch Conditions” supposed to work.

That’s why I want to confirm one point, and if is confirmed; I like to request a restrictions to be added to prevent others and myself from run into these issues again and again, as it took me 1 week to finaly figure it out.

Stil trying to upload a image
Attachments
X.jpg
X.jpg (166.96 KiB) Viewed 5866 times
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Locate file 4 level deep without search of Depth 4

Hello,

I'm glad you sorted this out.

Please keep in mind that the "Path" field of a folder search is of Formatted Type. This means you can also refer an installer property in this field and the property value will be resolved at install time. Therefore, as references added in fields of formatted data type are resolved only at install time I'm afraid we cannot perform any relevant check during or before build time.

If you have any question let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”