-1

I've just gotten into vbs and I've been messing around with it, (mainly opening message boxes) and I was wondering if their was a way to close open vbs message boxes with the same script. To keep things simple lets say the open vbs files are all 1.vbs or 2.vbs. I've tried looking up solutions online but none of them worked they were mainly for closing exe files or browser tabs. I would greatly appreciate it if somebody could help, thank you in advance

  • 2
    Not clear for me ?? can you edit your question and add your code and explain more your goal ! – Hackoo Oct 04 '19 at 21:33
  • Take a look at this code using a popup that will be closed with timeout ==> https://codereview.stackexchange.com/questions/229941/playing-music-in-the-background-while-another-task-is-running – Hackoo Oct 05 '19 at 08:22

1 Answers1

0

Refer to this Display text in a pop-up message box and this popup message box with examples

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.

Example Code :

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
Hackoo
  • 18,337
  • 3
  • 40
  • 70