0

出于某种原因,当我尝试使用下面的代码为不同的热键创建 2 个不同的菜单时,如果我尝试调用脚本 windows + x 的第二部分,我得到“错误:菜单不存在。当前线程将退出”。有人知道如何在一个脚本中运行 2 个不同的菜单线程吗?

; Creates a popup menu with 5 choices.
Menu, MyMenu, Add, Andrew, Andrew
Menu, MyMenu, Add, Anna, Anna
Menu, MyMenu, Add, Mark, Mark
Menu, MyMenu, Add, Tim, Tim

Menu, MyMenu, Add ; Add a separator line.
Menu, MyMenu, Add, Kind Regards, KindRegards

return

;Choice 1 "Andrew"Hi Anna,

Andrew:
send Hi Andrew,{enter}{enter}
send {Space}{Space}{Space}can you please take this ticket thanks.{enter}{enter}
send Kind Regards,{enter}{enter}{enter}
send Rupert.{enter}
return

;Choice 2 "Annna"
Anna:
Send Hi Anna,{enter}{enter}
send {Space}{Space}{Space}can you please take this ticket thanks.{enter}{enter}
send Kind Regards,{enter}{enter}{enter}
send Rupert.{enter}
return
;Choice 3 "Mark"
Mark:
send Hi Mark,{enter}{enter}
send {Space}{Space}{Space}can you please take this ticket thanks.{enter}{enter}
send Kind Regards,{enter}{enter}{enter}
send Rupert.{enter}
return


;Choice 4 "Tim"
Tim:
send Hi Tim{enter}{enter}
send {Space}{Space}{Space}can you please take this ticket thanks.{enter}{enter}
send Kind Regards,{enter}{enter}{enter}
send Rupert.{enter}
return

;Choice 5 "Kind Regards"
KindRegards:
send Kind Regards,{enter}{enter}{enter}
send Rupert.{enter}

#z::Menu, MyMenu, Show ; Display the menu when you hold the Windows Key & press the y key.

; EXAMPLE #2: This is a working script that creates a popup menu that is displayed when the user presses the Win-Z hotkey.

; Create the popup menu by adding some items to it.
Menu, MyMenuu, Add, Item1, MenuHandler
Menu, MyMenuu, Add, Item2, MenuHandler
Menu, MyMenuu, Add  ; Add a separator line.

; Create another menu destined to become a submenu of the above menu.
Menu, Submenu1, Add, Item1, MenuHandler
Menu, Submenu1, Add, Item2, MenuHandler

; Create a submenu in the first menu (a right-arrow indicator). When the user selects it, the second menu is displayed.
Menu, MyMenuu, Add, My Submenu, :Submenu1

Menu, MyMenuu, Add  ; Add a separator line below the submenu.
Menu, MyMenuu, Add, Item3, MenuHandler  ; Add another menu item beneath the submenu.
return  ; End of script's auto-execute section.

MenuHandler:
MsgBox You selected %A_ThisMenuItem% from the menu %A_ThisMenu%.
return

#x::Menu, MyMenuu, Show  ; i.e. press the Win-x hotkey to show the menu.
4

1 回答 1

0

你需要重新安排你的代码,第二个菜单“MyMenuu”需要在自动执行部分

于 2013-09-27T22:37:38.187 回答