vbscript - 如何用vbs关闭打开的vbs消息框
问题描述
我刚刚进入 vbs 并且一直在搞乱它(主要是打开消息框),我想知道它们是否是一种使用相同脚本关闭打开的 vbs 消息框的方法。为了简单起见,假设打开的 vbs 文件都是 1.vbs 或 2.vbs。我试过在网上查找解决方案,但它们都不起作用,它们主要用于关闭 exe 文件或浏览器选项卡。如果有人可以提供帮助,我将不胜感激,在此先感谢您
解决方案
请参阅此在弹出消息框中显示文本和此弹出消息框的示例
Display text in a pop-up message box. Syntax intButton = objShell.Popup(strText,[nSecondsToWait],[strTitle],[nType]) Arguments objShell : A WScript.Shell object strText : String value containing the text you want to appear in the pop-up message box. nSecondsToWait : Maximum length of time to display the pop-up message box (in seconds, Optional, default=infinite) strTitle : Title text string, Optional. nType : Type of buttons and icons (Numeric, Optional) These determine how the message box is used. IntButton : Number of the button (Integer value) This is the value returned when the user OK's the message box.
示例代码:
Dim WshShell, BtnCode
Set WshShell = WScript.CreateObject("WScript.Shell")
BtnCode = WshShell.Popup("Do you feel alright?", 7, "Answer This Question:", 4 + 32)
Select Case BtnCode
case 6 WScript.Echo "Glad to hear you feel alright."
case 7 WScript.Echo "Hope you're feeling better soon."
case -1 WScript.Echo "Is there anybody out there?"
End Select
推荐阅读
- excel - 按目标值过滤电子表格,并隐藏没有目标的电子表格
- jquery - trigger(listzt:updated) - 不能使用 'in' 运算符来搜索 'length' in
- python - 如何修复我的内部本地主机挂断?
- swift - 不能对“[...]”类型的不可变值使用变异成员
- python - 如何获取 tkinter 窗口标题栏的高度
- elixir - 当我运行`mix test`时如何修复“**(混合)找不到任务“compile.all””
- excel - 在 Excel 中更新单元格值时,如何使自定义排序自动更新?
- ssh - Visual Studio 代码远程 ssh 通过 ssh 代理
- javascript - 如何在基于 Webpack 的项目中导入 Foundation 6.5?
- unicode - UTF排查:不等号:≠,╘