From 15977d0a974cf83fdadd715961bac38ff320c464 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 15 Jul 2023 19:47:56 +0200 Subject: [PATCH] Improve automated downloads --- scripts/Windows/Scripts/BrowserAutomation.ps1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/Windows/Scripts/BrowserAutomation.ps1 b/scripts/Windows/Scripts/BrowserAutomation.ps1 index 72aaf315..ff55e13c 100644 --- a/scripts/Windows/Scripts/BrowserAutomation.ps1 +++ b/scripts/Windows/Scripts/BrowserAutomation.ps1 @@ -16,7 +16,8 @@ function Start-AutomatedDownload() { param( [Context] $context, [string] $url, - [string] $buttonSelector + [string] $buttonSelector, + [string] $outDir = $null ) $tempDir = $context.GetTempDirectory(); @@ -58,4 +59,13 @@ function Start-AutomatedDownload() { Write-Information "Waiting for download to finish..."; Start-Sleep 1; } + + $file = Get-ChildItem $tempDir; + + if (-not $outDir) { + $outDir = "."; + } + + $result = Move-Item $file $outDir -PassThru; + return $result; }