Update samy.ps1
This commit is contained in:
34
samy.ps1
34
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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user