poe2-bot/src-old/util/clipboard.ts
2026-02-13 01:12:11 -05:00

13 lines
360 B
TypeScript

import { execSync } from 'child_process';
export function readClipboard(): string {
try {
return execSync('powershell -command "Get-Clipboard"', { encoding: 'utf-8' }).trim();
} catch {
return '';
}
}
export function writeClipboard(text: string): void {
execSync(`powershell -command "Set-Clipboard -Value '${text.replace(/'/g, "''")}'"`);
}