MarcinK71
Posts: 16
Joined: Mon Aug 05, 2019 4:57 pm

A few problems I was not able to sort out....

Can somebody help me please with below problems or point me to related resources.

1. I have installer with custom installation path for some elements. So I have created custom Dlg with 3 PatheEdit boxes. How to set default path displayed in each of them during installation process. Property DefaultValue doesn't work here.

2. How to check if x file exist during installation in destination folder? If exist how to rename this file?

3. I have Enterprise project but can't find Terms and Cond functionality. I was trying to follow tutorials but I can't see anything mentioned there.... I have no InstallDlg as mentioned: "Files Location and License Terms (InstallDlg)".


Thanks in advance.
Catalin
Posts: 7492
Joined: Wed Jun 13, 2018 7:49 am

Re: A few problems I was not able to sort out....

Hello Marcin,
1. I have installer with custom installation path for some elements. So I have created custom Dlg with 3 PatheEdit boxes. How to set default path displayed in each of them during installation process. Property DefaultValue doesn't work here.
I have tested this just now using Advanced Installer 16.2 and setting the default path for the Path Edit control is working as intended. Are you testing this functionality using the latest version of Advanced Installer or an older one?
2. How to check if x file exist during installation in destination folder? If exist how to rename this file?
This can be done through our support for "Searches". Please have a look on the following article for more information about this:

- "Search page"

Now, based on this search, if the file exists or not, you can rename your file. In order to rename your file, a custom action will be needed (e.g. a PowerShell script, VBS, C# dll, etc.). Please have a look on the following articles for more information about custom actions:

1. "Windows Installer Custom Actions"

2. "Custom Actions list"
3. I have Enterprise project but can't find Terms and Cond functionality. I was trying to follow tutorials but I can't see anything mentioned there.... I have no InstallDlg as mentioned: "Files Location and License Terms (InstallDlg)".
In order to add the "InstallDlg" to your project, you can proceed as it follows:

1. go to "Dialogs" page

2. click on "WelcomeDlg"

3. press on the "Add Dialog" button from the ribbon and then select "InstallDlg"

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MarcinK71
Posts: 16
Joined: Mon Aug 05, 2019 4:57 pm

Re: A few problems I was not able to sort out....

Hi Catalin

@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.

@2 again here example would be useful as procedure seems to be complicated...

@3. I found this one. Thanks.

Regards, Marcin
Catalin
Posts: 7492
Joined: Wed Jun 13, 2018 7:49 am

Re: A few problems I was not able to sort out....

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
Capture.PNG (182.19 KiB) Viewed 9629 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
Capture2.PNG (48.11 KiB) Viewed 9629 times
Capture3.PNG
Capture3.PNG (48.48 KiB) Viewed 9629 times
Capture4.PNG
Capture4.PNG (49.95 KiB) Viewed 9629 times
After doing so, upon installation, the dialog should look like this:
Capture5.PNG
Capture5.PNG (21.66 KiB) Viewed 9629 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
Capture6.PNG (84.42 KiB) Viewed 9629 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
Capture7.PNG (6.83 KiB) Viewed 9629 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
Capture8.PNG (182.14 KiB) Viewed 9629 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
Capture9.PNG (103.95 KiB) Viewed 9629 times
Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”