首页 > 解决方案 > 如何用vbs关闭打开的vbs消息框

问题描述

我刚刚进入 vbs 并且一直在搞乱它(主要是打开消息框),我想知道它们是否是一种使用相同脚本关闭打开的 vbs 消息框的方法。为了简单起见,假设打开的 vbs 文件都是 1.vbs 或 2.vbs。我试过在网上查找解决方案,但它们都不起作用,它们主要用于关闭 exe 文件或浏览器选项卡。如果有人可以提供帮助,我将不胜感激,在此先感谢您

标签: vbscript

解决方案


请参阅此在弹出消息框中显示文本和此弹出消息框的示例

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

推荐阅读