From 84d19433f8ff8b320358ae9070db31eb27af62f6 Mon Sep 17 00:00:00 2001 From: Stephan Yelle Date: Sat, 20 Dec 2025 20:52:35 -0500 Subject: [PATCH] Update samy.ps1 --- samy.ps1 | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/samy.ps1 b/samy.ps1 index abf7f7e..13e9fa5 100644 --- a/samy.ps1 +++ b/samy.ps1 @@ -689,14 +689,37 @@ function Get-SamyTasks { $tasks = @($json | ConvertFrom-Json -ErrorAction Stop) if ($tasks.Count -eq 0) { throw "Tasks JSON parsed but contained no tasks." } - foreach ($t in $tasks) { - $tooltip = $null - if ($t.PSObject.Properties.Name -contains 'Tooltip') { $tooltip = [string]$t.Tooltip } - if ([string]::IsNullOrWhiteSpace($tooltip)) { $tooltip = [string]$t.Label } + foreach ($t in $tasks) { + $tooltipRaw = $null + if ($t.PSObject.Properties.Name -contains 'Tooltip') { + $tooltipRaw = $t.Tooltip + } + + # Normalize tooltip to a single string (prevents array -> "everything joined" tooltips) + $tooltip = if ($tooltipRaw -is [string]) { + $tooltipRaw + } + elseif ($tooltipRaw -is [System.Collections.IEnumerable] -and -not ($tooltipRaw -is [string])) { + # Tooltip was an array/list -> join it explicitly (or pick first) + (@($tooltipRaw) | ForEach-Object { [string]$_ }) -join ' ' + # If you only want the first item instead, use: + # [string](@($tooltipRaw)[0]) + } + else { + [string]$tooltipRaw + } + + # Fallback: tooltip defaults to label + if ([string]::IsNullOrWhiteSpace($tooltip)) { + $tooltip = [string]$t.Label + } + + # Ensure property exists and is updated if ($t.PSObject.Properties.Name -contains 'Tooltip') { $t.Tooltip = $tooltip - } else { + } + else { $t | Add-Member -NotePropertyName Tooltip -NotePropertyValue $tooltip -Force } } @@ -709,6 +732,7 @@ function Get-SamyTasks { } } + #endregion Remote Assets + Task Loading