OK, now I see what you're trying to do, and this makes it easier to work with.
What I would suggest though, is that you create your HTM file as below, and then only modify that when you want things to change.....
There is one possible catch with this though....because you're using VBScript code inside the HTM file to close the window, if the source of the file location isn't a Trusted Site in IE, then it will pop-up a security warning. So, I suggest hosting the HTM file on a web server, then placing that server name as a Trusted Site in IE (can be done via Group Policy), and then use VBS to navigate to that page.
So, here's the HTM that I modified:
<HTML><TITLE>
Login Message
</TITLE>
<BODY bgcolor="silver">
<INPUT TYPE='button' onclick='return window.close()' value='Close'/>
<BR>
<BR>
<BR>
<BR>
<CENTER><SPAN STYLE="color: green; font-size: 20pt">Hello World</SPAN></CENTER>
<CENTER><SPAN STYLE="color: green; font-size: 15pt">To find out more click below</SPAN></CENTER>
<CENTER><A HREF="http://intranet.com" target="_blank">Click Here</A></CENTER>
</BODY>
</HTML>
and here's the VBS to load that page:
'===================
strFile = Replace(WScript.ScriptFullName, WScript.ScriptName, "") & "Message.htm"
Set objExplorer = CreateObject("InternetExplorer.Application")
objExplorer.Visible = 1
objExplorer.Navigate strFile
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width=700
objExplorer.Height = 260
objExplorer.Left = 200
objExplorer.Top = 200
Do While objExplorer.ReadyState <> 4
Wscript.Sleep 200
Loop
' Now activate the window to bring it to the foreground
strWindowTitle = objExplorer.Document.Title & " - Microsoft Internet Explorer"
Set objShell = CreateObject("WScript.Shell")
objShell.AppActivate strWindowTitle
'===================
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_22936624.html
No comments:
Post a Comment