Function Reference


Replaces the HTML for the entire document

#include <IE.au3>
_IEDocWriteHTML ( ByRef $oObject, $sHTML )


$oObject Object variable of an InternetExplorer.Application, Window or Frame object
$sHTML The HTML string to write to the document

Return Value

Success: none.
Failure: 0 or -1 and sets the @error flag to non-zero.
@error: 1 ($_IEStatus_GeneralError) = General Error
2 ($_IEStatus_COMError) = COM Error in Object reference
3 ($_IEStatus_InvalidDataType) = Invalid Data Type
4 ($_IEStatus_InvalidObjectType) = Invalid Object Type
6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout
8 ($_IEStatus_AccessIsDenied) = Access Is Denied
9 ($_IEStatus_ClientDisconnected) = Client Disconnected
@extended: Contains invalid parameter number


This function completely replaces the content of the document in a browser or a frame.
It can be used to create a new page with custom HTML and JavaScript.

It is sometimes necessary to refresh the page after writing with _IEAction($oIE, "refresh") (e,g, after creating a FRAMESET).


_IEDocReadHTML, _IELoadWait


; Create an empty browser, write customer HTML to it - in this case a
; FRAMESET - and then update the contents of each of the frames

#include <IE.au3>

Local $oIE = _IECreate()
Local $sHTML = ""
$sHTML &= "<HTML>" & @CRLF
$sHTML &= "<HEAD>" & @CRLF
$sHTML &= "<TITLE>_IE_Example('frameset')</TITLE>" & @CRLF
$sHTML &= "</HEAD>" & @CRLF
$sHTML &= "<FRAMESET rows='25,200'>" & @CRLF
$sHTML &= " <FRAME NAME=Top SRC=about:blank>" & @CRLF
$sHTML &= " <FRAMESET cols='100,500'>" & @CRLF
$sHTML &= "   <FRAME NAME=Menu SRC=about:blank>" & @CRLF
$sHTML &= "   <FRAME NAME=Main SRC=about:blank>" & @CRLF
$sHTML &= " </FRAMESET>" & @CRLF
$sHTML &= "</HTML>"
_IEDocWriteHTML($oIE, $sHTML)
_IEAction($oIE, "refresh")
Local $oFrameTop = _IEFrameGetObjByName($oIE, "Top")
Local $oFrameMenu = _IEFrameGetObjByName($oIE, "Menu")
Local $oFrameMain = _IEFrameGetObjByName($oIE, "Main")
_IEBodyWriteHTML($oFrameTop, '$oFrameTop = _IEFrameGetObjByName($oIE, "Top")')
_IEBodyWriteHTML($oFrameMenu, '$oFrameMenu = _IEFrameGetObjByName($oIE, "Menu")')
_IEBodyWriteHTML($oFrameMain, '$oFrameMain = _IEFrameGetObjByName($oIE, "Main")')