* Check if clipboard contains an image (Windows)
()
| 213 | * Check if clipboard contains an image (Windows) |
| 214 | */ |
| 215 | function hasImageWindows(): boolean { |
| 216 | try { |
| 217 | const script = ` |
| 218 | Add-Type -AssemblyName System.Windows.Forms |
| 219 | if ([System.Windows.Forms.Clipboard]::ContainsImage()) { Write-Output "true" } else { Write-Output "false" } |
| 220 | ` |
| 221 | const result = spawnSync('powershell', ['-STA', '-Command', script], { |
| 222 | encoding: 'utf-8', |
| 223 | timeout: 5000, |
| 224 | }) |
| 225 | |
| 226 | return result.stdout?.trim() === 'true' |
| 227 | } catch { |
| 228 | return false |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * Read image from clipboard (Windows) |