Hello and welcome to Advanced Installer forums,
I want to get folder location containing specific folder on machine. For example if file is present on "C:\ABC\SearchFileName.txt" it should return "C:\ABC".
In order to search for a file on the target machine, you can go in the
Search page and create a
file search operation. Use the [ New Search Wizard ] toolbar button, to set up a new search, following step-by-step directions. If the search is successfully, then the property assigned to the Search operation will be set with the full path of the file (e.g. C:\ABC\SearchFileName.txt), otherwise it will be empty.
In order to retrieve the folder path, you need to create a custom action. Then, you can set the
APPDIR with the folder path. A sample code that performs this, is the following:
Code: Select all
'retrieve the file path from the search operation
filePath = Session.Property ("RESULT_PROPERTY")
'if file is found on the target machine
If Len(filePath) > 0 Then
'retrieve folder path
folderPath = Left ( filePath, InStrRev (filePath, "\") - 1)
'set the installation path with this value
Session.Property ("APPDIR") = folderPath
End If
By the way, I've attached a sample project which implements this scenario, so if you are interested to take a look directly at my project, you are more than welcome to download the ZIP file.
Also can I search for XML, read specific tag value and show this path in folder dialogue installation path.
For this you can take a look on the
Keep web.connfig settings from an older install path forum thread which debates this subject. You will also find a sample that implements your scenario.
Should there be any difficulty you encounter implementing something, please do not hesitate to contact me and I will gladly assist.
Best regards,
Dan
FOLLOW US
Get the latest news in Application Packaging