@fivetu53/soul-chat 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +3 -11
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -121,17 +121,9 @@ end try`;
|
|
|
121
121
|
if (result !== 'ok') return null;
|
|
122
122
|
} else if (process.platform === 'win32') {
|
|
123
123
|
// Windows: 用 PowerShell 导出剪贴板图片
|
|
124
|
-
|
|
125
|
-
const psScript = `
|
|
126
|
-
|
|
127
|
-
$img = [System.Windows.Forms.Clipboard]::GetImage()
|
|
128
|
-
if ($img) {
|
|
129
|
-
$img.Save('${tmpFile.replace(/\\/g, '/')}', [System.Drawing.Imaging.ImageFormat]::Png)
|
|
130
|
-
Write-Output 'ok'
|
|
131
|
-
} else {
|
|
132
|
-
Write-Output 'no'
|
|
133
|
-
}`;
|
|
134
|
-
const result = execSync(`powershell -NoProfile -ExecutionPolicy Bypass -Command "${psScript.replace(/"/g, '\\"').replace(/\n/g, ' ')}"`, { encoding: 'utf8', windowsHide: true }).trim();
|
|
124
|
+
const savePath = tmpFile.replace(/\\/g, '/');
|
|
125
|
+
const psScript = `Add-Type -AssemblyName System.Windows.Forms; $img = [System.Windows.Forms.Clipboard]::GetImage(); if ($img) { $img.Save('${savePath}', [System.Drawing.Imaging.ImageFormat]::Png); Write-Output 'ok' } else { Write-Output 'no' }`;
|
|
126
|
+
const result = execSync(`powershell -NoProfile -ExecutionPolicy Bypass -Command "${psScript}"`, { encoding: 'utf8', windowsHide: true }).trim();
|
|
135
127
|
if (result !== 'ok') return null;
|
|
136
128
|
} else {
|
|
137
129
|
return null;
|