Improve automated downloads

This commit is contained in:
Manuel Thalmann 2023-07-15 19:47:56 +02:00
parent f9cbebf902
commit 47814c7ad7

View file

@ -16,7 +16,8 @@ function Start-AutomatedDownload() {
param( param(
[Context] $context, [Context] $context,
[string] $url, [string] $url,
[string] $buttonSelector [string] $buttonSelector,
[string] $outDir = $null
) )
$tempDir = $context.GetTempDirectory(); $tempDir = $context.GetTempDirectory();
@ -58,4 +59,13 @@ function Start-AutomatedDownload() {
Write-Information "Waiting for download to finish..."; Write-Information "Waiting for download to finish...";
Start-Sleep 1; Start-Sleep 1;
} }
$file = Get-ChildItem $tempDir;
if (-not $outDir) {
$outDir = ".";
}
$result = Move-Item $file $outDir -PassThru;
return $result;
} }