fix: 桌面脚本强制 Per-Monitor DPI 感知,修复多屏缩放下点击坐标错位

This commit is contained in:
yu 2026-10-28 15:33:27 +08:00
parent 3b05d10ff4
commit 093fc302fa

View File

@ -52,7 +52,10 @@ export function parseUiaSelector(raw: unknown): UiaSelector {
return selector;
}
const UIA_USING = "Add-Type -AssemblyName UIAutomationClient, UIAutomationTypes;";
const UIA_USING = [
"Add-Type -AssemblyName UIAutomationClient, UIAutomationTypes;",
"try { Add-Type -MemberDefinition '[DllImport(\"user32.dll\")] public static extern bool SetProcessDpiAwarenessContext(IntPtr value);' -Name RpaDpi -Namespace WinRpaDpi | Out-Null; [WinRpaDpi.RpaDpi]::SetProcessDpiAwarenessContext([IntPtr](-4)) | Out-Null } catch {}"
].join("\n");
const FIND_HELPER = `
function Find-RpaWindow([string]$winName) {
@ -354,3 +357,4 @@ register("Element_WaitElementGround", waitElementGround);