mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-30 21:13:02 +08:00
发送消息、窗口管理统一通过句柄操作
This commit is contained in:
parent
7a7cb8dd54
commit
0ee3647261
@ -53,6 +53,9 @@ public class AutomationTool
|
|||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
private static extern bool IsWindowVisible(IntPtr hWnd);
|
private static extern bool IsWindowVisible(IntPtr hWnd);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern bool IsWindow(IntPtr hWnd);
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
private static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
|
private static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
|
||||||
|
|
||||||
@ -72,11 +75,6 @@ public class AutomationTool
|
|||||||
private const int WM_RBUTTONUP = 0x0205;
|
private const int WM_RBUTTONUP = 0x0205;
|
||||||
private const int WM_LBUTTONDBLCLK = 0x0203;
|
private const int WM_LBUTTONDBLCLK = 0x0203;
|
||||||
|
|
||||||
// 添加按键状态标志
|
|
||||||
private const int KEYEVENTF_KEYDOWN = 0x0;
|
|
||||||
private const int KEYEVENTF_EXTENDEDKEY = 0x1;
|
|
||||||
private const int KEYEVENTF_KEYUP = 0x2;
|
|
||||||
|
|
||||||
private delegate bool EnumWindowProc(IntPtr hwnd, IntPtr lParam);
|
private delegate bool EnumWindowProc(IntPtr hwnd, IntPtr lParam);
|
||||||
private delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
|
private delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
|
||||||
|
|
||||||
@ -164,8 +162,8 @@ public class AutomationTool
|
|||||||
|
|
||||||
switch (type.ToLower())
|
switch (type.ToLower())
|
||||||
{
|
{
|
||||||
case "inspect":
|
case "list":
|
||||||
// inspect 操作只获取第一个匹配窗口的控件树
|
// list 操作只获取第一个匹配窗口的控件树
|
||||||
string filter = GetArgumentValue(args, "-filter");
|
string filter = GetArgumentValue(args, "-filter");
|
||||||
bool background = bool.Parse(GetArgumentValue(args, "-background") ?? "false");
|
bool background = bool.Parse(GetArgumentValue(args, "-background") ?? "false");
|
||||||
|
|
||||||
@ -184,23 +182,18 @@ public class AutomationTool
|
|||||||
return; // 直接返回,不输出窗口信息
|
return; // 直接返回,不输出窗口信息
|
||||||
|
|
||||||
case "keyboard":
|
case "keyboard":
|
||||||
operatedWindow = HandleKeyboardOperation(targetHandle, args);
|
HandleKeyboardOperation(targetHandle, args);
|
||||||
|
Console.WriteLine("true");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "mouse":
|
case "mouse":
|
||||||
operatedWindow = HandleMouseOperation(targetHandle, args);
|
HandleMouseOperation(targetHandle, args);
|
||||||
|
Console.WriteLine("true");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new Exception("不支持的操作类型");
|
throw new Exception("不支持的操作类型");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 输出操作的窗口信息
|
|
||||||
if (operatedWindow != null)
|
|
||||||
{
|
|
||||||
var serializer = new JavaScriptSerializer();
|
|
||||||
Console.WriteLine(serializer.Serialize(operatedWindow));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -224,7 +217,12 @@ public class AutomationTool
|
|||||||
// 如果是handle方法,直接返回指定句柄
|
// 如果是handle方法,直接返回指定句柄
|
||||||
if (method.ToLower() == "handle")
|
if (method.ToLower() == "handle")
|
||||||
{
|
{
|
||||||
targetWindows.Add(new IntPtr(long.Parse(value)));
|
IntPtr handle = new IntPtr(long.Parse(value));
|
||||||
|
if (!IsWindow(handle))
|
||||||
|
{
|
||||||
|
throw new Exception("指定的句柄不是一个有效的窗口句柄");
|
||||||
|
}
|
||||||
|
targetWindows.Add(handle);
|
||||||
return targetWindows;
|
return targetWindows;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +294,7 @@ public class AutomationTool
|
|||||||
return targetWindows;
|
return targetWindows;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Dictionary<string, object> HandleKeyboardOperation(IntPtr targetHandle, string[] args)
|
private static void HandleKeyboardOperation(IntPtr targetHandle, string[] args)
|
||||||
{
|
{
|
||||||
string control = GetArgumentValue(args, "-control");
|
string control = GetArgumentValue(args, "-control");
|
||||||
string action = GetArgumentValue(args, "-action");
|
string action = GetArgumentValue(args, "-action");
|
||||||
@ -349,10 +347,10 @@ public class AutomationTool
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 返回操作结果
|
// 返回操作结果
|
||||||
return GetBasicWindowInfo(targetHandle, controlHandle);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Dictionary<string, object> HandleMouseOperation(IntPtr targetHandle, string[] args)
|
private static void HandleMouseOperation(IntPtr targetHandle, string[] args)
|
||||||
{
|
{
|
||||||
string control = GetArgumentValue(args, "-control");
|
string control = GetArgumentValue(args, "-control");
|
||||||
string controlText = GetArgumentValue(args, "-text");
|
string controlText = GetArgumentValue(args, "-text");
|
||||||
@ -438,7 +436,7 @@ public class AutomationTool
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 返回操作结果
|
// 返回操作结果
|
||||||
return GetBasicWindowInfo(targetHandle, controlHandle);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SendKeys(IntPtr hWnd, string keys)
|
private static void SendKeys(IntPtr hWnd, string keys)
|
||||||
@ -749,7 +747,6 @@ public class AutomationTool
|
|||||||
}
|
}
|
||||||
else if (matchedControls.Count > 1)
|
else if (matchedControls.Count > 1)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Warning: 找到多个匹配控件:");
|
|
||||||
foreach (IntPtr handle in matchedControls)
|
foreach (IntPtr handle in matchedControls)
|
||||||
{
|
{
|
||||||
StringBuilder text = new StringBuilder(256);
|
StringBuilder text = new StringBuilder(256);
|
||||||
@ -764,43 +761,6 @@ public class AutomationTool
|
|||||||
return matchedControls[0];
|
return matchedControls[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HandleInspectOperation(string[] args)
|
|
||||||
{
|
|
||||||
string filter = GetArgumentValue(args, "-filter");
|
|
||||||
bool background = bool.Parse(GetArgumentValue(args, "-background") ?? "false");
|
|
||||||
|
|
||||||
var targetWindows = FindTargetWindows(args);
|
|
||||||
if (targetWindows.Count == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 创建一个列表存储所有窗口的控件树数组
|
|
||||||
List<string> allWindowTrees = new List<string>();
|
|
||||||
|
|
||||||
foreach (IntPtr hWnd in targetWindows)
|
|
||||||
{
|
|
||||||
// 只在非后台操作时激活窗口
|
|
||||||
if (!background)
|
|
||||||
{
|
|
||||||
SetForegroundWindow(hWnd);
|
|
||||||
Thread.Sleep(50);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取当前窗口的控件树并添加到列表
|
|
||||||
// 注意:每个控件树已经是一个数组
|
|
||||||
string treeJson = GetControlsTree(hWnd, filter);
|
|
||||||
if (!string.IsNullOrEmpty(treeJson) && treeJson != "{}")
|
|
||||||
{
|
|
||||||
// 将每个控件树作为一个数组元素添加
|
|
||||||
allWindowTrees.Add("[" + treeJson + "]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 将所有窗口的控件树数组合并成一个大数组
|
|
||||||
Console.WriteLine("[" + string.Join(",", allWindowTrees) + "]");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string GetControlsTree(IntPtr parentHandle, string filter, int depth = 0)
|
private static string GetControlsTree(IntPtr parentHandle, string filter, int depth = 0)
|
||||||
{
|
{
|
||||||
if (parentHandle == IntPtr.Zero)
|
if (parentHandle == IntPtr.Zero)
|
||||||
@ -881,7 +841,7 @@ sendmessage.exe -type <操作类型> [参数...]
|
|||||||
--------
|
--------
|
||||||
1. keyboard - 键盘操作
|
1. keyboard - 键盘操作
|
||||||
2. mouse - 鼠标操作
|
2. mouse - 鼠标操作
|
||||||
3. inspect - 获取控件树
|
3. list - 获取控件树
|
||||||
|
|
||||||
通用参数:
|
通用参数:
|
||||||
--------
|
--------
|
||||||
@ -927,7 +887,7 @@ sendmessage.exe -type <操作类型> [参数...]
|
|||||||
sendmessage.exe -type keyboard -action text -window ""记事本"" -value ""Hello"" -background
|
sendmessage.exe -type keyboard -action text -window ""记事本"" -value ""Hello"" -background
|
||||||
|
|
||||||
5. 获取窗口控件树:
|
5. 获取窗口控件树:
|
||||||
sendmessage.exe -type inspect -window ""记事本"" -filter ""button""
|
sendmessage.exe -type list -window ""记事本"" -filter ""button""
|
||||||
|
|
||||||
6. 使用句柄查找窗口:
|
6. 使用句柄查找窗口:
|
||||||
sendmessage.exe -type keyboard -method handle -window ""0x12345"" -value ""Hello""
|
sendmessage.exe -type keyboard -method handle -window ""0x12345"" -value ""Hello""
|
||||||
@ -945,7 +905,7 @@ sendmessage.exe -type <操作类型> [参数...]
|
|||||||
返回值:
|
返回值:
|
||||||
------
|
------
|
||||||
1. 均为JSON格式
|
1. 均为JSON格式
|
||||||
2. inspect操作返回控件树信息
|
2. list操作返回控件树信息
|
||||||
3. 其他操作返回操作的控件信息及其所在窗口信息
|
3. 其他操作返回操作的控件信息及其所在窗口信息
|
||||||
4. 失败均抛出异常
|
4. 失败均抛出异常
|
||||||
|
|
||||||
@ -956,56 +916,4 @@ sendmessage.exe -type <操作类型> [参数...]
|
|||||||
";
|
";
|
||||||
Console.WriteLine(help);
|
Console.WriteLine(help);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Dictionary<string, object> GetBasicWindowInfo(IntPtr hwnd, IntPtr controlHandle = default(IntPtr))
|
|
||||||
{
|
|
||||||
var info = new Dictionary<string, object>();
|
|
||||||
|
|
||||||
// 获取窗口信息
|
|
||||||
StringBuilder title = new StringBuilder(256);
|
|
||||||
StringBuilder className = new StringBuilder(256);
|
|
||||||
GetWindowText(hwnd, title, title.Capacity);
|
|
||||||
GetClassName(hwnd, className, className.Capacity);
|
|
||||||
|
|
||||||
int processId = 0;
|
|
||||||
GetWindowThreadProcessId(hwnd, out processId);
|
|
||||||
string processName = "";
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var process = System.Diagnostics.Process.GetProcessById(processId);
|
|
||||||
processName = process.ProcessName;
|
|
||||||
}
|
|
||||||
catch { }
|
|
||||||
|
|
||||||
// 窗口信息放在 window 键下
|
|
||||||
info["window"] = new Dictionary<string, object>
|
|
||||||
{
|
|
||||||
{ "handle", hwnd.ToInt64() },
|
|
||||||
{ "title", title.ToString() },
|
|
||||||
{ "class", className.ToString() },
|
|
||||||
{ "process", processName }
|
|
||||||
};
|
|
||||||
|
|
||||||
// 如果有控件信息,添加到顶层
|
|
||||||
if (controlHandle != IntPtr.Zero)
|
|
||||||
{
|
|
||||||
StringBuilder controlTitle = new StringBuilder(256);
|
|
||||||
StringBuilder controlClassName = new StringBuilder(256);
|
|
||||||
GetWindowText(controlHandle, controlTitle, controlTitle.Capacity);
|
|
||||||
GetClassName(controlHandle, controlClassName, controlClassName.Capacity);
|
|
||||||
|
|
||||||
info["handle"] = controlHandle.ToInt64();
|
|
||||||
info["title"] = controlTitle.ToString();
|
|
||||||
info["class"] = controlClassName.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 如果没有控件,设置为 null
|
|
||||||
info["handle"] = null;
|
|
||||||
info["title"] = null;
|
|
||||||
info["class"] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,8 @@ public class WindowManager
|
|||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
private static extern bool IsZoomed(IntPtr hWnd);
|
private static extern bool IsZoomed(IntPtr hWnd);
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern bool IsWindow(IntPtr hWnd);
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
|
private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
|
||||||
|
|
||||||
@ -242,7 +244,12 @@ public class WindowManager
|
|||||||
switch (method.ToLower())
|
switch (method.ToLower())
|
||||||
{
|
{
|
||||||
case "handle":
|
case "handle":
|
||||||
targetWindows.Add(new IntPtr(long.Parse(value)));
|
IntPtr handle = new IntPtr(long.Parse(value));
|
||||||
|
if (!IsWindow(handle))
|
||||||
|
{
|
||||||
|
throw new Exception("指定的句柄不是一个有效的窗口句柄");
|
||||||
|
}
|
||||||
|
targetWindows.Add(handle);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "active":
|
case "active":
|
||||||
|
@ -123,7 +123,10 @@ async function runAutomation(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error = err.toString().trim();
|
error = err
|
||||||
|
.toString()
|
||||||
|
.replace(/^Error: /, "")
|
||||||
|
.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === "inspect") return { error };
|
if (type === "inspect") return { error };
|
||||||
|
@ -2,7 +2,7 @@ const { runCsharpFeature } = require("../../csharp");
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行消息发送操作
|
* 执行消息发送操作
|
||||||
* @param {string} type - 操作类型, 可选值: "keyboard"|"mouse"|"inspect"
|
* @param {string} type - 操作类型, 可选值: "keyboard"|"mouse"|"list"
|
||||||
* @param {Object} params - 参数对象
|
* @param {Object} params - 参数对象
|
||||||
* @param {string} params.method - 查找方式:"title"|"handle"|"process"|"class"|"active"
|
* @param {string} params.method - 查找方式:"title"|"handle"|"process"|"class"|"active"
|
||||||
* @param {string} params.window - 窗口标题、句柄、进程名、类名
|
* @param {string} params.window - 窗口标题、句柄、进程名、类名
|
||||||
@ -47,7 +47,7 @@ async function runSendMessage(type, params = {}) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "inspect":
|
case "list":
|
||||||
if (filter) {
|
if (filter) {
|
||||||
args.push("-filter", filter);
|
args.push("-filter", filter);
|
||||||
}
|
}
|
||||||
@ -61,54 +61,53 @@ async function runSendMessage(type, params = {}) {
|
|||||||
try {
|
try {
|
||||||
const result = await runCsharpFeature("sendmessage", args);
|
const result = await runCsharpFeature("sendmessage", args);
|
||||||
if (result) {
|
if (result) {
|
||||||
const jsonResult = JSON.parse(result);
|
const resultStr = result.toString().trim();
|
||||||
if (type === "inspect") {
|
if (type === "list") return JSON.parse(resultStr);
|
||||||
return jsonResult;
|
if (resultStr === "true") return { success: true };
|
||||||
}
|
|
||||||
return { success: true, control: jsonResult };
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error = err
|
error = err
|
||||||
.toString()
|
.toString()
|
||||||
.replace(/^Error: /, "")
|
.replace(/^Error: /, "")
|
||||||
.trim();
|
.trim();
|
||||||
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === "inspect") return [];
|
if (type === "list") return [];
|
||||||
return { success: false, error };
|
return { success: false, error };
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
sendKeys: (method, window, keys, options = {}) =>
|
sendKeys: (windowHandle, keys, options = {}) =>
|
||||||
runSendMessage("keyboard", {
|
runSendMessage("keyboard", {
|
||||||
method,
|
method: windowHandle ? "handle" : "active",
|
||||||
window,
|
window: windowHandle,
|
||||||
action: "keys",
|
action: "keys",
|
||||||
value: keys,
|
value: keys,
|
||||||
options,
|
options,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
sendText: (method, window, text, options = {}) =>
|
sendText: (windowHandle, text, options = {}) =>
|
||||||
runSendMessage("keyboard", {
|
runSendMessage("keyboard", {
|
||||||
method,
|
method: windowHandle ? "handle" : "active",
|
||||||
window,
|
window: windowHandle,
|
||||||
action: "text",
|
action: "text",
|
||||||
value: text,
|
value: text,
|
||||||
options,
|
options,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
click: (method, window, action = "click", options = {}) =>
|
click: (windowHandle, action = "click", options = {}) =>
|
||||||
runSendMessage("mouse", {
|
runSendMessage("mouse", {
|
||||||
method,
|
method: windowHandle ? "handle" : "active",
|
||||||
window,
|
window: windowHandle,
|
||||||
action,
|
action,
|
||||||
options,
|
options,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
inspectWindow: (method, window, options = {}) =>
|
listControls: (windowHandle, options = {}) =>
|
||||||
runSendMessage("inspect", {
|
runSendMessage("list", {
|
||||||
method,
|
method: windowHandle ? "handle" : "active",
|
||||||
window,
|
window: windowHandle,
|
||||||
options,
|
options,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
@ -57,7 +57,7 @@ async function runWindow(type, params = {}) {
|
|||||||
if (type === "info") {
|
if (type === "info") {
|
||||||
return jsonResult;
|
return jsonResult;
|
||||||
}
|
}
|
||||||
return { success: true, window: jsonResult };
|
return { success: true };
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error = err
|
error = err
|
||||||
@ -72,27 +72,63 @@ async function runWindow(type, params = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
setTopMost: (method, window, isTopMost) =>
|
setTopMost: (windowHandle, isTopMost) =>
|
||||||
runWindow("topmost", { method, window, value: isTopMost }),
|
runWindow("topmost", {
|
||||||
|
method: windowHandle ? "handle" : "active",
|
||||||
|
window: windowHandle,
|
||||||
|
value: isTopMost,
|
||||||
|
}),
|
||||||
|
|
||||||
setOpacity: (method, window, opacity) =>
|
setOpacity: (windowHandle, opacity) =>
|
||||||
runWindow("opacity", { method, window, value: opacity }),
|
runWindow("opacity", {
|
||||||
|
method: windowHandle ? "handle" : "active",
|
||||||
|
window: windowHandle,
|
||||||
|
value: opacity,
|
||||||
|
}),
|
||||||
|
|
||||||
setWindowRect: (method, window, x, y, width, height) =>
|
setWindowRect: (windowHandle, x, y, width, height) =>
|
||||||
runWindow("rect", { method, window, value: { x, y, width, height } }),
|
runWindow("rect", {
|
||||||
|
method: windowHandle ? "handle" : "active",
|
||||||
|
window: windowHandle,
|
||||||
|
value: { x, y, width, height },
|
||||||
|
}),
|
||||||
|
|
||||||
setWindowState: (method, window, state) =>
|
setWindowState: (windowHandle, state) =>
|
||||||
runWindow("state", { method, window, value: state }),
|
runWindow("state", {
|
||||||
|
method: windowHandle ? "handle" : "active",
|
||||||
|
window: windowHandle,
|
||||||
|
value: state,
|
||||||
|
}),
|
||||||
|
|
||||||
closeWindow: (method, window) => runWindow("close", { method, window }),
|
closeWindow: (windowHandle) =>
|
||||||
|
runWindow("close", {
|
||||||
|
method: windowHandle ? "handle" : "active",
|
||||||
|
window: windowHandle,
|
||||||
|
}),
|
||||||
|
|
||||||
setFocus: (method, window) => runWindow("focus", { method, window }),
|
setFocus: (windowHandle) =>
|
||||||
|
runWindow("focus", {
|
||||||
|
method: windowHandle ? "handle" : "active",
|
||||||
|
window: windowHandle,
|
||||||
|
}),
|
||||||
|
|
||||||
setBorder: (method, window, hasBorder) =>
|
setBorder: (windowHandle, hasBorder) =>
|
||||||
runWindow("border", { method, window, value: hasBorder }),
|
runWindow("border", {
|
||||||
|
method: windowHandle ? "handle" : "active",
|
||||||
|
window: windowHandle,
|
||||||
|
value: hasBorder,
|
||||||
|
}),
|
||||||
|
|
||||||
setClickThrough: (method, window, isTransparent) =>
|
setClickThrough: (windowHandle, isTransparent) =>
|
||||||
runWindow("clickthrough", { method, window, value: isTransparent }),
|
runWindow("clickthrough", {
|
||||||
|
method: windowHandle ? "handle" : "active",
|
||||||
|
window: windowHandle,
|
||||||
|
value: isTransparent,
|
||||||
|
}),
|
||||||
|
|
||||||
getWindowInfo: (method, window) => runWindow("info", { method, window }),
|
getWindowInfo: (method, window) =>
|
||||||
|
runWindow("info", {
|
||||||
|
method,
|
||||||
|
window,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
@ -177,15 +177,19 @@ const searchWindowConfig = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const searchElementConfig = [
|
const windowHandleConfig = [
|
||||||
{
|
{
|
||||||
label: "窗口句柄",
|
label: "窗口句柄",
|
||||||
component: "VariableInput",
|
component: "VariableInput",
|
||||||
icon: "window",
|
icon: "window",
|
||||||
width: 12,
|
width: 12,
|
||||||
placeholder: "留空则使用当前活动窗口",
|
placeholder: "可从搜索/选择窗口获取,留空则使用当前活动窗口",
|
||||||
defaultValue: newVarInputVal("str", ""),
|
defaultValue: newVarInputVal("str", ""),
|
||||||
},
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const searchElementConfig = [
|
||||||
|
windowHandleConfig,
|
||||||
{
|
{
|
||||||
label: "元素查找方式",
|
label: "元素查找方式",
|
||||||
component: "q-select",
|
component: "q-select",
|
||||||
@ -267,7 +271,7 @@ export const windowsCommands = {
|
|||||||
value: "quickcomposer.windows.window.setTopMost",
|
value: "quickcomposer.windows.window.setTopMost",
|
||||||
label: "窗口控制",
|
label: "窗口控制",
|
||||||
icon: "window",
|
icon: "window",
|
||||||
config: searchWindowConfig,
|
config: windowHandleConfig,
|
||||||
subCommands: [
|
subCommands: [
|
||||||
{
|
{
|
||||||
value: "quickcomposer.windows.window.setTopMost",
|
value: "quickcomposer.windows.window.setTopMost",
|
||||||
@ -630,14 +634,14 @@ export const windowsCommands = {
|
|||||||
},
|
},
|
||||||
// sendmessage
|
// sendmessage
|
||||||
{
|
{
|
||||||
value: "quickcomposer.windows.sendmessage.inspectWindow",
|
value: "quickcomposer.windows.sendmessage.listControls",
|
||||||
label: "发送控制消息",
|
label: "发送控制消息",
|
||||||
icon: "smart_button",
|
icon: "smart_button",
|
||||||
isAsync: true,
|
isAsync: true,
|
||||||
config: searchWindowConfig,
|
config: windowHandleConfig,
|
||||||
subCommands: [
|
subCommands: [
|
||||||
{
|
{
|
||||||
value: "quickcomposer.windows.sendmessage.inspectWindow",
|
value: "quickcomposer.windows.sendmessage.listControls",
|
||||||
label: "获取控件树",
|
label: "获取控件树",
|
||||||
icon: "account_tree",
|
icon: "account_tree",
|
||||||
outputVariable: "controlsTree",
|
outputVariable: "controlsTree",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user