更灵活的自定义的Dialog类,可以用来平替内置的InputBox命令
AHK v1代码
#requires Autohotkey v1.0
answer := Dialog("输出结果:", "good")
MsgBox, % "you answered: " answer
ExitAppDialog(Question, DefaultValue := "") {return new Dialog(Question, DefaultValue).Wait()
}
class Dialog
{__New(Question, DefaultValue) {Gui, New, +hwndhGui +LabelDialog.On_, Dialogthis.hwnd := hGuiGui, Add, Text,, % QuestionGui, Add, Edit, w200 h100 hwndhEdit, %DefaultValue%this.hEdit := hEditGui, Add, Button, gDialog.On_ButtonSendAnswer, 确定this.SaveStatus := FalseGui, Show