Skip to content

Commit

Permalink
增加快速删除功能
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzxs committed Aug 13, 2022
1 parent cdd02c6 commit 6cb1f48
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion menu.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ global g_hook_command := ""
global g_hook_mode := false
global g_should_reload := false
global g_my_menu_map := {"增加一条命令: " convert_key2str(g_config.key_edit_new) : "edit_new"
, "删除当前命令: delete" : "label_delete"
, "编辑当前命令: " convert_key2str(g_config.key_edit_now) : "edit_now"
, "编辑全部命令: " convert_key2str(g_config.key_open_editor) : "open_editor"
, "发送到窗口: " convert_key2str(g_config.key_send) : "label_send_command"
Expand All @@ -111,6 +112,7 @@ if !FileExist(A_ScriptDir "\cmd\Menus\超级命令.xml")
fileread, xml_file_content,% "*P65001 " A_ScriptDir "\cmd\Menus\超级命令.xml"
my_xml.XML.LoadXML(xml_file_content)
cmds := xml_parse(my_xml)
my_xml.file := A_ScriptDir "\cmd\Menus\超级命令.xml"

;注册热键
Hotkey,% g_config.key_open_search_box , main_label
Expand Down Expand Up @@ -259,10 +261,17 @@ return
run,% A_ScriptDir "\v1\AutoHotkey.exe " A_ScriptDir "\cmd\menue_create.ahk " my_pid
return

~Delete::
gosub, label_delete
return

label_delete:
if(!WinActive("ahk_id " MyGuiHwnd) || g_command == "")
return

if(m("无法撤销, 确定删除?","ico:?","btn:ync","def:2")!="Yes")
return

GuiControlGet Command
if !Command
return
Expand All @@ -276,10 +285,11 @@ label_delete:
node := my_xml.SSN(pattern)
if(!Next:=Node.NextSibling?Node.NextSibling:Node.PreviousSibling)
Next:=Node.ParentNode
Next.SetAttribute("last",1)
;Next.SetAttribute("last",1)
Node.ParentNode.RemoveChild(Node)
my_xml.save(1)
Populate()
reload
return

Populate(SetLast:=0){
Expand Down
Binary file modified menu.exe
Binary file not shown.

0 comments on commit 6cb1f48

Please sign in to comment.