Update samy.ps1
This commit is contained in:
20
samy.ps1
20
samy.ps1
@@ -691,25 +691,34 @@ function Get-SamyTasks {
|
|||||||
|
|
||||||
foreach ($t in $tasks) {
|
foreach ($t in $tasks) {
|
||||||
|
|
||||||
# Grab Tooltip if it exists
|
|
||||||
$tooltipRaw = $null
|
$tooltipRaw = $null
|
||||||
if ($t.PSObject.Properties.Name -contains 'Tooltip') {
|
if ($t.PSObject.Properties.Name -contains 'Tooltip') {
|
||||||
$tooltipRaw = $t.Tooltip
|
$tooltipRaw = $t.Tooltip
|
||||||
}
|
}
|
||||||
|
|
||||||
# Normalize tooltip to a single string (defensive)
|
# Normalize tooltip to a single string
|
||||||
$tooltip = if ($tooltipRaw -is [string]) {
|
$tooltip = if ($tooltipRaw -is [string]) {
|
||||||
$tooltipRaw
|
$tooltipRaw
|
||||||
}
|
}
|
||||||
elseif ($tooltipRaw -is [System.Collections.IEnumerable] -and -not ($tooltipRaw -is [string])) {
|
elseif ($tooltipRaw -is [System.Collections.IEnumerable] -and -not ($tooltipRaw -is [string])) {
|
||||||
# If Tooltip is an array/list, treat as bad data and fall back to Label
|
$arr = @(
|
||||||
[string]$t.Label
|
$tooltipRaw |
|
||||||
|
ForEach-Object { [string]$_ } |
|
||||||
|
Where-Object { -not [string]::IsNullOrWhiteSpace($_) }
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($arr.Count -eq 1) {
|
||||||
|
$arr[0] # single tooltip item
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
[string]$t.Label # array or multiple items => treat as bad data, fallback to label
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
[string]$tooltipRaw
|
[string]$tooltipRaw
|
||||||
}
|
}
|
||||||
|
|
||||||
# Final fallback: tooltip defaults to label
|
# Fallback: tooltip defaults to label
|
||||||
if ([string]::IsNullOrWhiteSpace($tooltip)) {
|
if ([string]::IsNullOrWhiteSpace($tooltip)) {
|
||||||
$tooltip = [string]$t.Label
|
$tooltip = [string]$t.Label
|
||||||
}
|
}
|
||||||
@@ -733,6 +742,7 @@ function Get-SamyTasks {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion Remote Assets + Task Loading
|
#endregion Remote Assets + Task Loading
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user