Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

反馈两个问题 #109

Open
showyourlucky opened this issue Sep 18, 2023 · 0 comments
Open

反馈两个问题 #109

showyourlucky opened this issue Sep 18, 2023 · 0 comments

Comments

@showyourlucky
Copy link

showyourlucky commented Sep 18, 2023

一、启动管理启动ahk脚本失败

复现场景

  1. 启动管理添加启动应用
  2. 选择全路径, 勾选以管理员启动, 路径填入任意一个ahk脚本, 比如d:\test.ahk

问题分析

d:\test.ahk并没有启动, 执行了Run *RunAs d:\test.ahk
因为test.ahk并不是一个可执行文件, 导致上面命令变成了赋权操作

建议

以管理员运行ahk脚本时, 加入ahk 运行路径, 比如Run *RunAs d:\AutoHotkey\AutoHotkey.exe d:\test.ahk

二、如果菜单只属于后缀菜单,打开一次后缀菜单就会删除一个菜单项

复现场景

  1. 配置后缀菜单
-js菜单|js
	项目1
	项目2
	项目3
	--子菜单1
		子项11
	--子菜单2
		子项21
  1. 选中js文件, 展示runany后缀菜单, 第一次显示正常, 重复操作, 第二次字菜单1消失, 第三次字菜单2消失

问题分析

直接原因是 try Menu,%extMenuName%,Delete, %MenuObjTreeMaxSepNum%&
删除了菜单项
MenuObjTreeMaxSepNum只统计了项目1,项目2,项目3, 并没有计入子菜单1和子菜单2, 上面例子 %MenuObjTreeMaxSepNum%& = 3
每次展示菜单都会删除 第四个菜单项, 直到菜单子项数目小于4
尝试修复, 将
try Menu,%extMenuName%,Delete, %MenuObjTreeMaxSepNum%&
修改为
item_count := DllCall("GetMenuItemCount", "ptr", MenuGetHandle(extMenuName))
try Menu,%extMenuName%,Delete, %item_count%&

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant