Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBS Popup Window - Possible? 1

Status
Not open for further replies.

JTeagle

Programmer
May 30, 2000
49
GB
Is it possible to open a popup window using VBScript only? Yes, I _know_ I can do it with JS, but I want to know if it is possible with VBS - if JS can do it, I'd expect MS to make sure that VBS can also do it.
 


Jteagle,

Set WshShell = Wscript.CreateObject("Wscript.Shell")

' 2 is number of seconds window stays open. If you
' leave it out, then window stays open until click OK.
WshShell.popup "Your text message here", 2
 
Hmmm... that's a great trick, but I was thinking of opening a browser window with a new document in it - like an advertisement, or some info, or something - the VBScript equivalent of JavaScript's "window.open(...)". I'm sorry for not making that clearer in the post.
 
Wscript.echo or msgbox() will pop up windows on your screen. If you want to open a web window,try something like what I do to popup a log-file in notepad here, by calling the application you want to open- hope it helps:
'************************************************
' CallExecutable Sub
' This sub initializes a command line shell to
' kick off a given script
'************************************************
Sub CallExecutable(strScript,intWindow)
Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run strScript,intWindow,TRUE
End Sub
Dim strTempName
strTempName = "C:\temp\test.log

Call CallExecutable("notepad.exe " & strTempName,1)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top