r/vbscript • • Nov 29 '20
Auto closing msgbox?
How can I create a msgbox that closes automatically after a period of time and (If possible) can’t be closed by a Person?
1
Upvotes
r/vbscript • • Nov 29 '20
How can I create a msgbox that closes automatically after a period of time and (If possible) can’t be closed by a Person?
2
u/jcunews1 Nov 29 '20
Not possible. At least not with VBScript alone.
2
u/Lord1340 Nov 30 '20
CreateObject("WScript.Shell").Popup "MessageHere", 10, "Title"
This works
2
u/Lord1340 Nov 30 '20
Sorry, i don’t that works, Will look in it tomorrow
1
u/Lord1340 Nov 30 '20
It’s seconds
2
u/billr1965 Nov 30 '20
I know this is a VbScript sub but I wrote a Powershell functions that uses the underlying ComObject Wscript.Shell and the Popup method, which I believe is the same engine as VbScript. In that Powershell function there is an option for a TimeOut value (int Seconds), 0=no timeout. This should be fairly easy to translate to VbScript equivalent and syntax.
Powershell function
An example of how to use the function from within Powershell
New-PopUp -Message 'This is the message' -Title 'Title Info' -Time 5 -Buttons OKCancel -Icon Information1
u/gzesasaki Jan 30 '24
it works, the only downside is popped up twice.. :)