Update samy.ps1

This commit is contained in:
2025-12-20 20:52:35 -05:00
parent 71099bb0ac
commit 84d19433f8

View File

@@ -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