'How do I open multiple message boxes in vbs?

I know that if you input

Do

msgbox("This is a msg box")

loop

Then a msg box pops up that won't go away.

I want multiple message boxes that you ARE able to close.

How do I do this?



Solution 1:[1]

You want to look for non-modal dialogs. The msgbox that you pop-up here are modal, that's why they come one after the other (execution is suspended while the dialog is open).

You will find references for this on the web.

Func _NoHaltMsgBox($code=0, $title = "",$text = "" ,$timeout = 0)
  Run (@AutoItExe & ' /AutoIt3ExecuteLine  "MsgBox(' & $code & ', '''& $title & ''', '''& $text &''',' & $timeout & ')"')
EndFunc

Solution 2:[2]

WARNING: You're probably going to encounter severe lag and or crashing. I am not held responsible of any damages if you choose to continue.

You can make a batch file that opens the same VBS script many times. Make a notepad with:

msgbox("YourTextHere")

Or if you want to loop it:

do
msgbox("YourTextHere")
loop

Replace YourTextHere with whatever you want.

Then save it as .vbs

then make another notepad:

start "MessageBox" "MessageBox.vbs"

Change "MessageBox" with the name of the message box VBS you made.

Copy and paste the same script multiple times to open it more times (Do this at your own risk, you may encounter severe lag).

Then save it as .bat

Or add the batch file itself multiple times so it can create a loop of opening batch files which can open more scripts out of them. (Do this at your own risk, you may encounter severe lag).

For example:

start "BatchFile" "Batchfile.bat"

Change "BatchFile" with the name of the Batchfile you made.

Copy and paste it multiple times to open it more times again (Do this at your own risk, you may encounter severe lag).

So far, you're okay since you did not open the .bat file. IF you try testing it, It'll open multiple instances of your .bat file and the message box, then open more instances off the new instances, then more instances off the even newer instances, and repeat enough to make your PC crash or lag.

Solution 3:[3]

If you don't want to use a batch file, try this:
Step 1 - the error message
Let's say you wanted a=msgbox("messageboxtext"). So, in Notepad, you would write a=msgbox("messageboxtext") and save it as a .vbs file.
Step 2 - the spammer
Infinitely
In a new Notepad document, paste this:

set shell = createobject("wscript.shell")
count = "hello world"
do until count = 1
shell.run("""C:\Users\user\Documents\error.vbs""")
loop

Replace C:\Users\user\Documents\error.vbs with the location of the file. Save it as a .vbs file.
Finitely
To open a finite number of windows, use this code:

set shell = createobject("wscript.shell")
count = 0
do until count = 5
shell.run("""C:\Users\user\Documents\error.vbs""")
loop

Replace the 5 with the number of times you would like the message to spawn.

Enjoy!

Solution 4:[4]

You need a multiple button MsgBox, set it as a value then: if CANCEL is pressed, the process will stop.

Do
spam=MsgBox("SPAM",3)
If spam = 2 Then
WScript.Quit
End If
Loop

Solution 5:[5]

  1. First make an File called "anything.vbs" replace anything with anything you want.
  2. Then Edit it and Put in the Code
msgbox("LOL")
loop"
  1. Replace LOL with anything you Like.
  2. Then make a .bat File.
  3. Put in the Code
start "LOL.bat"
loop"

Now you have a Spammer. :)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 d-stroyer
Solution 2
Solution 3 ouflak
Solution 4 bennygenel
Solution 5 ouflak