Hello Brent and welcome to Advanced Installer forums,
There are two approaches to your problem here, both of them including a custom action.
The first approach, which is easier, would be to use our predefined
"Open URL". In this custom action, you can pass as parameters the direct download link for your files, whether it is the Open JDK 11 or the audio files.
Cons of this approach:
1- the output folder can not be configured. The files will be downloaded in the default location that is set on the target machine
2- additional steps required in order to achieve your first task (to also install the Open JDK 11).
The second approach would be to create a script (e.g. PowerShell) which will do both of the above steps. For instance, we can use the WebClient class which provides common methods for sending data to and receiving data from a resource identified by a URI. The method that we need to use here is the WebClient.DownloadFile() method, which takes as input the following:
- the URI address
- the output folder which also must contain the filename
For example, here is a little PowerShell script which downloads Notepad++ in a predefined folder that I have created on my Desktop:
Code: Select all
url = "https://notepad-plus-plus.org/repository/7.x/7.6.4/npp.7.6.4.Installer.exe"
$outputFolder = "C:\Users\Catalin\Desktop\MyFolder\npp.7.6.4.Installer.exe"
$webClient = New-object System.Net.WebClient
$webClient.DownloadFile($url,$outputFolder)
For instance, if you want Notepad++ to be downloaded before your main package is launched, you can proceed as it follows:
- open your project and go to
"Custom Actions" page.
- here add a
"PowerShellScriptInline" custom action
with sequence. In order to add a custom action with sequence, all you have to do is to press the
"Add custom action with sequence" button which is placed to the right side of the custom action's name.
- now copy and paste the content of the above script under the "Your code goes here" comment.
- you can schedule the custom action to only execute during Install by unchecking the "Uninstall" and "Maintenance" options from under the
"Dialogs Stage Condition" section.
- depending on the time you want the custom action to be executed, you can schedule it accordingly by simply dragging and dropping it in the installation sequence. Since our example was to download the Notepad++ before the main setup is launched, please schedule the custom action before
"Searches" action group -
"Wizard Dialogs Stage"
Quick note: Up until now, these are the steps that are required to fulfill your second request (just to download some audio files to a specific location)
Now, in order to fulfill your first request (also install the file after the download process is complete), we can add some more functionality to our script. For instance, if after the download, we want to silently install the Notepad++, we can proceed as it follows:
Modify the script to also install Notepad++:
Code: Select all
$url = "https://notepad-plus-plus.org/repository/7.x/7.6.4/npp.7.6.4.Installer.exe"
$outputFolder = "C:\Users\Catalin\Desktop\MyFolder\npp.7.6.4.Installer.exe"
$webClient = New-object System.Net.WebClient
$webClient.DownloadFile($url,$outputFolder)
Start-Process -Wait -FilePath $outputFolder -ArgumentList "/S"
The steps on how to implement this within your Advanced Installer project are the same as those described above.
Hope this helps.
All the best,
Catalin