使用不了

使用问题 · 127 次浏览
GM-J 创建于 2026-07-23 15:09

设置了鼠标触发也无法切换窗口,不知道我的哪里设置有问题


若尘丶 2026-07-23 18:07 :

截图看看设置

GM-J 回复 若尘丶 2026-07-23 20:00 :


若尘丶 回复 GM-J 2026-07-23 20:19 :

cur_down意思是相同的进程向下切换  比如两个文件夹窗口之间切换  如果只有一个进程就不能生效

GM-J 回复 若尘丶 2026-07-23 22:00 :

打开了几个进程了,切换就提示错误

若尘丶 回复 GM-J 2026-07-24 10:31 :

复现不了,方便的话进编辑点一下调试  然后把调试文件发我看看

回复内容
GM-J 2026-07-24 11:55
#1
 
Win-10.0.22000.0 Quicker-1.41.5.0 动作ID:501b3599-49c7-407e-ae9d-858fcd1db82e 来源动作:c07b2420-4740-4f5f-ddce-08dee6ba3591 v0
Log文件路径:C:\Users\Administrator\AppData\Local\Temp\quicker_切换窗口_115138-522_log.html 定位文件 复制文件 上传并复制网址
开始执行动作:切换窗口 2026-07-24 11:51:38
1动作初始化
 
10获取窗口信息/查找窗口前台窗口
[in]失败后停止【值/表达式】True
[in]目标窗口【值/表达式】foreground
[out]句柄=>handle396148
[out]进程名=>procNamechrome
[in]窗口位置包含不可见边框(阴影区域)【值/表达式】False
耗时:9ms
101运行C#代码
[in]失败后停止【值/表达式】True
[in]运行模式【值/表达式】normal_roslyn
[in]脚本内容【值/表达式】//.cs 文件类型,便于外部编辑时使用\r\n // 引用必要的命名空间\r\n using System.Windows.Forms;\r\n using System.Collections.Generic;\r\n using System.Runtime.InteropServices;\r\n using System.Text;\r\n using System.Linq;\r\n // Quicker将会调用的函数。可以根据需要修改返回值类型。\r\n public static void Exec(Quicker.Public.IStepContext context)\r\n {\r\n //var oldValue = context.GetVarValue("varName"); // 读取动作里的变量值\r\n //MessageBox.Show(oldValue as string);\r\n //context.SetVarValue("varName", "从脚本输出的内容。"); // 向变量里输出值\r\n var par = context.GetVarValue("quicker_in_param").ToString();\r\n var list = Win32.GetAltTabWindows().OrderBy(x => x.procName).ThenBy(x => (int)x.hwnd).ToList();\r\n if (par.StartsWith("all"))\r\n {\r\n \r\n }\r\n else\r\n {\r\n var processName = context.GetVarValue("procName").ToString();\r\n list = list.Where(x => x.procName == processName).ToList();\r\n }\r\n if (list == null || list.Count == 0)\r\n return;\r\n var hwnd = (IntPtr)int.Parse(context.GetVarValue("handle").ToString());\r\n var index = list.FindIndex(x => x.hwnd == hwnd);\r\n if (par.Contains("up"))\r\n {\r\n index--;\r\n if (index < 0) index = list.Count - 1;\r\n }\r\n else if (par.Contains("down"))\r\n {\r\n index++;\r\n if (index >= list.Count) index = 0;\r\n }\r\n context.SetVarValue("cur_hwnd", list[index].hwnd);\r\n }\r\n private class WinInfo\r\n {\r\n public IntPtr hwnd;\r\n public string procName;\r\n }\r\n private static class Win32\r\n {\r\n delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);\r\n \r\n [DllImport("user32.dll")]\r\n static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam);\r\n \r\n [DllImport("user32.dll")]\r\n static extern bool IsWindowVisible(IntPtr hWnd);\r\n \r\n [DllImport("user32.dll")]\r\n static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd);\r\n \r\n [DllImport("user32.dll")]\r\n static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);\r\n \r\n [DllImport("user32.dll")]\r\n static extern int GetWindowTextLength(IntPtr hWnd);\r\n \r\n [DllImport("user32.dll")]\r\n static extern uint GetWindowLong(IntPtr hWnd, int nIndex);\r\n \r\n [DllImport("dwmapi.dll")]\r\n static extern int DwmGetWindowAttribute(IntPtr hwnd, int attr, out int attrValue, int attrSize);\r\n [DllImport("user32.dll")]\r\n static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);\r\n \r\n const uint GW_OWNER = 4;\r\n const int GWL_EXSTYLE = -20;\r\n const uint WS_EX_TOOLWINDOW = 0x00000080;\r\n const int DWMWA_CLOAKED = 14;\r\n \r\n static bool IsAltTabWindow(IntPtr hWnd)\r\n {\r\n if (!IsWindowVisible(hWnd))\r\n return false;\r\n \r\n if (GetWindow(hWnd, GW_OWNER) != IntPtr.Zero)\r\n return false;\r\n \r\n uint exStyle = GetWindowLong(hWnd, GWL_EXSTYLE);\r\n if ((exStyle & WS_EX_TOOLWINDOW) != 0)\r\n return false;\r\n \r\n if (GetWindowTextLength(hWnd) == 0)\r\n return false;\r\n \r\n if (Environment.OSVersion.Version.Major >= 6)\r\n {\r\n int cloaked;\r\n DwmGetWindowAttribute(hWnd, DWMWA_CLOAKED, out cloaked, sizeof(int));\r\n if (cloaked != 0)\r\n return false;\r\n }\r\n \r\n return true;\r\n }\r\n \r\n static bool IsTargetProcess(IntPtr hWnd, string processName)\r\n {\r\n uint pid;\r\n GetWindowThreadProcessId(hWnd, out pid);\r\n \r\n try\r\n {\r\n var proc = System.Diagnostics.Process.GetProcessById((int)pid);\r\n return proc.ProcessName.Equals(processName, StringComparison.OrdinalIgnoreCase);\r\n }\r\n catch\r\n {\r\n return false;\r\n }\r\n }\r\n static WinInfo GetInfo(IntPtr hwnd)\r\n {\r\n uint pid;\r\n GetWindowThreadProcessId(hwnd, out pid);\r\n try\r\n {\r\n var proc = System.Diagnostics.Process.GetProcessById((int)pid);\r\n return new WinInfo() { hwnd = hwnd, procName = proc.ProcessName };\r\n }\r\n catch\r\n {\r\n return new WinInfo();\r\n }\r\n }\r\n \r\n public static List<WinInfo> GetAltTabWindows()\r\n {\r\n var list = new List<WinInfo>();\r\n EnumWindows((hWnd, l) =>\r\n {\r\n if (IsAltTabWindow(hWnd))\r\n list.Add(GetInfo(hWnd));\r\n return true;\r\n }, IntPtr.Zero);\r\n return list;\r\n }\r\n }
[in]执行线程【值/表达式】auto
线程类型:Ui
[in]引用DLL库【值/表达式】
使用缓存的程序集:C:\Users\Administrator\AppData\Local\Temp\quicker_cs\1.41.5.0\ED6B1AB9D8E1092CD9C27E333E2D3606.dll
[out]脚本写入=>cur_hwnd396148
耗时:72ms
822窗口操作设置为前台窗口
[in]失败后停止【值/表达式】True
[in]类型【值/表达式】SET_FOREGROUND
[in]窗口句柄【变量 cur_hwnd】396148
耗时:0ms
动作结束。耗时:83.1874ms
若尘丶 回复 GM-J 2026-07-27 08:40 :

看这个是正常的没有报错啊

回复主贴