Hello Marcin,
@3. I found this one. Thanks.
I am glad you found this one.
@1. Unfortunately i have no idea how to make it work. Can you send me any pictures, tutorial or point to the help source? I assume then in PathEdit control I need to set Property "Default Value" to the one I want. I am getting always C:\
Yes, I am using latest Advanced installer.
In what regards this, please keep in mind that, by default, the Path Edit control has the APPDIR property assigned to it. The reason why this does not work is because one of your controls is overwriting the other one.
Here is a quick explanation so you can better understand:
Property - Properties are global variables used by Windows Installer during an installation. Their values can be set by the operating environment or by authoring them into the installation database.
Almost every control has a property assigned to it. This property is useful to further use the value saved in it. For instance, an edit box is used to let user input data during the installation time. If the user wants to access that data during the installation property, he can do so through the property which stores what the user did input in the edit box.
By default, in Advanced Installer, you can find the Path Edit control in the
"FolderDlg" dialog. Its assigned property is the APPDIR property.
The APPDIR property represents the path of the
"Application Folder" in the
"Files and Folders" page (it is usually the main installation folder).
Now, going back to what we have discussed earlier. If on your newly created dialog, you add two Path Edit controls, they will have the property assigned to them set to APPDIR by default:

- Capture.PNG (182.19 KiB) Viewed 9623 times
This means that, when you set one of the Path Edit's default value, all the default values will be changed since they do share the same property.
A workaround for this problem would be
to change the property assigned to each of your Path Edit controls.
This can be done by going to
"Dialogs" page --> select your dialog --> select the Path Edit control --> on the right pane, change the
"Property Name" field from APPDIR to anything you desire, for instance:
MY_FIRST_PATH.
Accordingly, you can proceed in renaming the property assigned to your other controls.
Here is an example of how all of this can look:

- Capture2.PNG (48.11 KiB) Viewed 9623 times

- Capture3.PNG (48.48 KiB) Viewed 9623 times

- Capture4.PNG (49.95 KiB) Viewed 9623 times
After doing so, upon installation, the dialog should look like this:

- Capture5.PNG (21.66 KiB) Viewed 9623 times
If you want your files to be installed in the path saved in those properties, you can simply create a property based folder. A property based folder is a folder whose default path is a property's value.
For instance, the
"Application Folder" from the
"Files and Folders" page has the default path of the APPDIR property (which is
"C:\Program Files\Your Company\Your Application" by default)
In order to create a property based folder, you can proceed as it follows:
1. go to
"Files and Folders" page
2. right click -->
"New Folder" -->
"Property Based"

- Capture6.PNG (84.42 KiB) Viewed 9623 times
After doing so, the
"Select a Property" dialog will be spawned, asking you to select the property which should be assigned to your folder. If you expand
"User Interface", you will be able to find the earlier created properties there.

- Capture7.PNG (6.83 KiB) Viewed 9623 times
Hope things are more clear now in what regards this.
@2 again here example would be useful as procedure seems to be complicated...
In what regards this, as I have previously explained, we need two things: our predefined support for searches and a custom action. However, this can all be achieved through a custom action (without our predefined support for searches - to avoid further confusion).
For instance, let's say you want to know if a file exists in a well-known folder.
For this, we can use a simple PowerShell script which will do this. For instance, the
"Test-Path" cmdlet will either return true or false, depending on whether the file exists or not.
Here is how our PowerShell script would look like:
Note: For this, I have used a sample text file, placed on my desktop folder.
Code: Select all
$path = "C:\Users\Catalin\Desktop\sampleText.txt"
if((Test-Path $path) -eq "True") {
Rename-Item -Path $path -NewName "your_new_name"
}
This simple script works as it follows: first, it will check if the file exists in the folder and then, if yes, it will rename it.
Now that we have created the script, it is time to implement it in Advanced Installer. To do so, please open your project and:
1. go to
"Custom Actions" page
2. add a
"Run PowerShell inline script" custom action
with sequence. In order to add a custom action with sequence, simply press the
"Add custom action with sequence" button which is placed to the right side of the custom action's name.

- Capture8.PNG (182.14 KiB) Viewed 9623 times
3. now simply copy paste the above code under the "Your code goes here" comment.
4. after doing so, we will need to schedule this custom action to run at the start of the installation. In order to do so, simply schedule it after the
"Searches" action group -->
"Wizard Dialogs Stage". To do so, simply drag and drop it.
In the end, it should look like this:

- Capture9.PNG (103.95 KiB) Viewed 9623 times
Hope this helps.
Best regards,
Catalin