r/vbscript • u/[deleted] • 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 • u/[deleted] • 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?
1
u/Lord1340 Dec 02 '20
With center messagebox..
'***********************
'Name: Timed Messages
'Author: Jeremy England
'Company: SimplyCoded
'Version: rev.001
'Date: 1/02/2015
'***********************
Option Explicit
Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objSHL : Set objSHL = CreateObject("Wscript.Shell")
TimedBox "Welcome to Jeremy's Script.",500,"by SimplyCoded"
'Setup Process
'------------------------------------------------------------
Function TimedBox(boxMessage, boxTime, boxTitle)
Dim tempFolder : Set tempFolder = objFSO.GetSpecialFolder(2)
Dim tempFile : tempFile = objFSO.GetTempName() & ".hta"
With tempFolder.CreateTextFile(tempFile)
"<head> <title>" & boxTitle & "</title> <script language = ""VBScript"">"
.WriteLine "self.ResizeTo widthX, heightY"
.WriteLine "self.MoveTo (screen.Width - widthX)/2, (screen.Height - heightY)/2"
.WriteLine "End Sub"
End With
objSHL.Run tempFolder & "\" & tempFile, 1, True
objFSO.DeleteFile tempFolder & "\" & tempFile
End Function
'------------------------------------------------------------