windows – AutoHotKey:带多行输入的InputBox
发布时间:2020-12-14 01:59:34 所属栏目:Windows 来源:网络整理
导读:在AutoHotKey中,我希望有类似InputBox的东西,除了文本输入是多行的. (比如textarea). 我希望有两个按钮,“Ok”和“Cancel”,我希望它们都有加速器.我希望这个代码是一个函数的形式,我可以从其他热键调用,以便随时获取多行用户输入.我希望能够设置显示对话框
在AutoHotKey中,我希望有类似InputBox的东西,除了文本输入是多行的. (比如textarea).
我希望有两个按钮,“Ok”和“Cancel”,我希望它们都有加速器.我希望这个代码是一个函数的形式,我可以从其他热键调用,以便随时获取多行用户输入.我希望能够设置显示对话框时显示的默认文本.如果按下取消按钮,我希望函数返回null或空字符串.我希望Esc键使对话框关闭,就像按下取消按钮一样(并且不退出整个脚本).我希望对话框显示在屏幕的中央,并使用Windows通常用于对话框的字体. 解决方法
试试这个
!1:: MsgBox % MultiLineInputBox("Hello World:","stuff,more stuff","Custom Caption") return MultiLineInputBox(Text:="",Default:="",Caption:="Multi Line Input Box"){ static ButtonOK:=ButtonCancel:= false if !MultiLineInputBoxGui{ Gui,MultiLineInputBox: add,Text,r1 w600,% Text Gui,Edit,r10 w600 vMultiLineInputBox,% Default Gui,Button,w60 gMultiLineInputBoxOK,&OK Gui,w60 x+10 gMultiLineInputBoxCancel,&Cancel MultiLineInputBoxGui := true } GuiControl,MultiLineInputBox:,MultiLineInputBox,% Default Gui,MultiLineInputBox: Show,% Caption SendMessage,0xB1,-1,Edit1,A while !(ButtonOK||ButtonCancel) continue if ButtonCancel return Gui,MultiLineInputBox: Submit,NoHide Gui,MultiLineInputBox: Cancel return MultiLineInputBox ;---------------------- MultiLineInputBoxOK: ButtonOK:= true return ;---------------------- MultiLineInputBoxGuiEscape: MultiLineInputBoxCancel: ButtonCancel:= true Gui,MultiLineInputBox: Cancel return } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- Extjs窗口中的视频未扩展到全屏
- 解决错误“Microsoft.NETCore.App 1.0.0不支持框架.NETFram
- windows – 远程运行调用“以管理员身份运行”的脚本
- windows-8 – Windows 8商店证书:由于认证(发布商ID)[已关
- windows-server-2008 – Windows性能计数器中的(*)是什么
- winforms – 如何检查单选按钮是否以Windows窗体形式检查
- 在Windows上以管理员身份运行Java应用程序
- 部署 – 在没有签名证书的情况下在Windows 8上部署VSTO加载
- Microsoft Edge不允许对websockets进行localhost环回
- windows-phone-7 – 如何在wp7中获得scrollview的最大偏移量