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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript no longer shows image within IE

Status
Not open for further replies.

DotNetNewbie

Programmer
Mar 3, 2004
344
GB
Hi,

I wrote a VBScript some years ago to do a multitude of things when a user logs in. Part of this was an IE window that was used to display any emergency message which included a JPG image that was copied to the local machine.

The file copy process works fine, unfortunately the image is now no longer displayed in IE7 or IE8. I have searched around and found varies pieces of code but unfortunately they also have the same issue.

If anyone can give me some advice I would be most grateful:

Set MSIE = CreateObject("InternetExplorer.Application")
Logo = "C:\Companylogo.jpg"
sTitle = "Emergency Message"

MSIE.Navigate "About:Blank"
MSIE.ToolBar = False
MSIE.StatusBar = False
MSIE.Resizable = False

Do
Loop While MSIE.Busy

SWidth = MSIE.Document.ParentWindow.Screen.AvailWidth
SHeight = MSIE.Document.ParentWindow.Screen.AvailHeight
MSIE.Width = Swidth/2
MSIE.Height = SHeight/2
MSIE.Left = (SWidth - MSIE.Width)/2
MSIE.Top = (Sheight - MSIE.Height)/2

MSIE.Visible = True

MSIE.Document.Write "<HTML><TITLE>" & sTitle & "</TITLE><BODY bgcolor=#FFFFFF><FONT FACE=Verdana>"
MSIE.Document.Write "<p><img border=0 src=" & logo & " width=272 height=121></p><hr>"

If Hour(Now) < 12 Then
MSIE.Document.Write "<B>Good Morning"</B><BR><BR>"
ElseIf Hour(Now) < 18 Then
MSIE.Document.Write "<B>Good Afternoon"</B><BR><BR>"
Else
MSIE.Document.Write "<B>Good Evening"</B><BR><BR>"
End If

MSIE.Document.Write "</FONT></BODY>"
Wscript.Sleep 3000
MSIE.Quit

Many thanks,

David
 
I believe that IE security no longer allows this. I know for sure that FireFox does not:

Put your image on an internal or external web server and you should be good.

Code:
Set MSIE = CreateObject("InternetExplorer.Application")
Logo = "[URL unfurl="true"]http://www.thespidersparlor.com/images/tsplogo.jpg"[/URL]
sTitle = "Emergency Message"

 MSIE.Navigate "About:Blank"
  MSIE.ToolBar = False
  MSIE.StatusBar = False
  MSIE.Resizable = False

  Do
    Loop While MSIE.Busy

    SWidth = MSIE.Document.ParentWindow.Screen.AvailWidth
    SHeight = MSIE.Document.ParentWindow.Screen.AvailHeight
    MSIE.Width = Swidth/2
    MSIE.Height = SHeight/2
    MSIE.Left = (SWidth - MSIE.Width)/2
    MSIE.Top = (Sheight - MSIE.Height)/2

    MSIE.Visible = True

MSIE.Document.Write "<HTML><TITLE>" & sTitle & "</TITLE><BODY bgcolor=#FFFFFF><FONT FACE=Verdana>"
MSIE.Document.Write "<p><img src='" & logo & "'></p><hr>"

If Hour(Now) < 12 Then
  MSIE.Document.Write "<B>Good Morning</B><BR><BR>"
ElseIf Hour(Now) < 18 Then
  MSIE.Document.Write "<B>Good Afternoon</B><BR><BR>"
Else
  MSIE.Document.Write "<B>Good Evening</B><BR><BR>"
End If

MSIE.Document.Write "</FONT></BODY></HTML>"
WScript.Sleep 3000
MSIE.Quit

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top