Page 1 of 1 1
Topic Options
#87264 - 2002-08-14 07:32 PM IE COM object won't display inline images
operagost Offline
Fresh Scripter

Registered: 2002-07-05
Posts: 13
I shamelessly reused and modified a UDF posted here to create a change password dialog in IE. I wanted a simple informational window to tell the user where they logged in, but messagebox() wasn't cutting it because sometimes a mystery app would steal focus and cause the box to never time out. So, I stripped out the forms and put what was left in my script. Everything works except a company logo I placed inline. If I run the script locally, it's okay, but when I run it on logon the image doesn't appear. This happens no matter how I address it:

file:///@ldrive\logon-banner.gif
http://our.intra.net/logon-banner.gif
@ldrive\logon-banner.gif
%systemroot%\logon-banner.gif (after copying to local drive)

Is there some sort of security problem I need to address here?

code:
	DIM $title, $top, $left, $height, $Width, $False, $true
DIM $status, $doc, $nul, $html

$top = "320"
$left = "200"
$height = "120"
$width = "300"
$false = 0
$true = -1
$title = "Welcome, $fullname."
$msg = "You have logged onto $domain, $site."
$html= '<html>
<head>
<title>$title</title>
<style>
<!--body{ background-color: mediumblue; color: white;font-family: baskerville old face, arial;

font-size:
11pt; margin: 3px }input.tbox { border: lpx black solid;}td { font: 11 pt baskerville old face;

}--->
</style>
</head>

<body scroll=no onresize="window.resizeto(300,120);" >
<img src="file:///@ldrive\logon-banner.gif" height=51 width=166 alt="">
<br>
$msg
</font>
</body>
</html>'

$ie = CreateObject("internetexplorer.application")

; Set properties and display form ...
$ie.addressbar = $false
$ie.menubar = $false
$ie.toolbar = $false
$ie.statusbar = $false
$ie.resizable = $false
$ie.top = $top
$ie.left = $left
$ie.height = $height
$ie.width = $width
$ie.visible = $true

$ie.navigate("about:blank")

; Get a handle to the open document ...
$doc = $ie.document
$doc.write($html)

color w+/b
gosub getparent
gosub sync
gosub home
gosub files
gosub printers

$ie.quit()


Top
#87265 - 2002-08-14 07:56 PM Re: IE COM object won't display inline images
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
For whats it worth, my guess is that the script is not properly (fully) syncing-up when fetching the Document Object from Internet Explorer.

The Navigate method call is asynchronous - it returns emmediately - and the Document object isn't "ready" until the navigation fully completes. The way to handle this is to perform the navigate, then enter a tight loop waiting for it to finish, then "fetch" your Document object handle, here's an exmaple using your script:

; Get a handle to the open document ...

$doc = $ie.document

while $ie.busy and $ie.readystate <> 4 and @error = 0 loop

$doc.write($html)


Hope this helps.

-Shawn

Top
#87266 - 2002-08-14 08:00 PM Re: IE COM object won't display inline images
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
The Docment object can be sync'd as well, if the above doesn't help, try this:

$doc.write($html)

while $doc.readystate <> 4 and @error = 0 loop

[ 14. August 2002, 20:01: Message edited by: Shawn ]

Top
#87267 - 2002-08-15 06:29 PM Re: IE COM object won't display inline images
operagost Offline
Fresh Scripter

Registered: 2002-07-05
Posts: 13
Thanks Shawn. I actually decided that some Kixgui mojo would be more useful for us. I modified one of the progress indicator scripts to put the logo on the left and text/bar on the right. It comes up more quickly than the IE window, as well.
Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1619 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.058 seconds in which 0.031 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org