Hi all
I have an AS script that expose a URL as result in a UI popup, as the script is executed inside the LCA
UIBuilder uib = new UIBuilder();
UIBlockDefinition link = new UIBlockDefinition();
link.Type = UIBlockType.DownloadButton;
link.ConfigOptions = new AutomationDownloadButtonOptions()
{
Url = "https://url",
StartDownloadImmediately = false,
FileNameToSave = "",
ReturnWhenDownloadIsStarted = true,
};
link.Title = "link";
uib.AppendBlock(link);
UIResults res = new UIResults();
do
{
res = engine.ShowUI(uib);
} while (!res.WasOnDownloadStarted("link"));
I setted the url as Download button so the user is able to click on it and the new webpage will be opened, I also need to add the do block so the popup stay opened so the user can click on it.
But how I can let the popup auto-close when the download start? I tried with WasOnDownloadStarted but it not works
Hi Marco,
You will need to set a destination variable on your UI component.
In your use case, please set destination variable of UIBlockDefinition link:
link.DestVar = "link";
Also, you need to update he builder so it can receive responses:
uib.RequireResponse = true;
Then it should work if you do not touch the condition in the while loop.
More info:
- Property DestVar | DataMiner Docs
- Method WasOnDownloadStarted | DataMiner Docs
Hope this helps you further.
Looking forward to your positive reply.
Note: if things work, then you could then change you while loop from hardcoded "link" to link.DestVar.