AHK,例如:
; create the gui:
Gui, +AlwaysOnTop
; DropDownList:
; Gui, Add, DDL, gAction vChoise Choose1 w200, one|two|three|four
; ListBox:
Gui, Add, ListBox, gAction vChoise w200 h60, one|two|three|four
return
; Press F1 to show the gui:
F1::
CoordMode, Mouse, Screen
MouseMove, 40, 50, 0
Gui, Show, x0 y0, Actions
return
Action:
Gui, Submit ; or
; Gui, Submit, NoHide ; if you don't want to hide the gui-window after an action
If (Choise = "one")
MsgBox, 1st action
If (Choise = "two")
MsgBox, 2nd action
If (Choise = "three")
MsgBox, 3rd action
If (Choise = "four")
MsgBox, 4th action
return
GuiClose:
ExitApp
编辑
如果要使用向上/向下箭头和Enter选择操作,则需要向gui 添加默认按钮
或这个:
Gui, +AlwaysOnTop
Gui, Add, ListBox, gAction vChoise w200 h60, one|two|three|four
return
; Press F1 to show the gui:
F1:: Gui, Show, x0 y0, Actions
Action:
If ((A_GuiEvent = "DoubleClick") || (Trigger_Action))
{
Gui, Submit
If (Choise = "one")
MsgBox, 1st action
If (Choise = "two")
MsgBox, 2nd action
If (Choise = "three")
MsgBox, 3rd action
If (Choise = "four")
MsgBox, 4th action
}
return
#If WinActive("Actions ahk_class AutoHotkeyGUI")
Enter::
Trigger_Action := true
GoSub, Action
Trigger_Action := false
return
#If
GuiClose:
ExitApp