From cd714115cd6456726d6051040b6a539cc856010d Mon Sep 17 00:00:00 2001 From: Joeri Date: Sat, 21 Feb 2026 15:17:04 +0100 Subject: [PATCH] - --- bleachbit.ps1 | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/bleachbit.ps1 b/bleachbit.ps1 index 19226b7..69e7b6d 100644 --- a/bleachbit.ps1 +++ b/bleachbit.ps1 @@ -95,9 +95,25 @@ try { } Write-Host $outputText + + # Extract specific lines + $diskSpace = "" + $filesDeleted = "" + + $lines = $outputText -split "`n" + foreach ($line in $lines) { + if ($line -match "Vrijgekomen schijfruimte:\s*(.+)") { + $diskSpace = $matches[1].Trim() + } + if ($line -match "Aantal verwijderde bestanden:\s*(.+)") { + $filesDeleted = $matches[1].Trim() + } + } + } catch { - $outputText = "Error running BleachBit: $($_.Exception.Message)" - Write-Host $outputText + $diskSpace = "" + $filesDeleted = "" + Write-Host "Error running BleachBit: $($_.Exception.Message)" } finally { # Cleanup temp files if (Test-Path $stdoutFile) { Remove-Item $stdoutFile -ErrorAction SilentlyContinue } @@ -107,7 +123,8 @@ try { # Output JSON result $result = @{ success = $true - output = $outputText + diskSpace = $diskSpace + filesDeleted = $filesDeleted } | ConvertTo-Json -Compress Write-Output $result \ No newline at end of file