Create an Internet Explorer Browser Window.
#include <IE.au3>
_IECreate([$s_Url = "about:blank" [, $f_tryAttach = 0 [, $f_visible = 1 [, $f_wait = 1 [, $f_takeFocus = 1]]]]])
| $s_Url | [optional] specifies the Url to navigate to upon creation |
| $f_tryAttach | [optional] specifies whether to try to attach to an existing window 0 = (Default) do not try to attach 1 = Try to attach to an existing window |
| $f_visible | [optional] specifies whether the browser window will be visible 0 = Browser Window is hidden 1 = (Default) Browser Window is visible |
| $f_wait | [optional] specifies whether to wait for page to load before returning 0 = Return immediately, not waiting for page to load 1 = (Default) Wait for page load to complete before returning |
| $f_takeFocus | [optional] specifies whether to bring the attached window to focus 0 = Do not bring window into focus 1 = (Default) bring window into focus |
| Success: | Returns an object variable pointing to an InternetExplorer.Application object |
| Failure: | Returns 0 and sets @ERROR |
| @Error: | 0 ($_IEStatus_Success) = No Error |
| 1 ($_IEStatus_GeneralError) = General Error | |
| 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: | Set to true (1) or false (0) depending on the success of $f_tryAttach |
; *******************************************************
; Example 1 - Create a browser window and navigate to a website
; *******************************************************
#include <IE.au3>
Local $oIE = _IECreate("www.autoitscript.com")
; *******************************************************
; Example 2 - Create new browser windows pointing to each of 3 different URLs
; if one does not already exist ($f_tryAttach = 1)
; do not wait for the page loads to complete ($f_wait = 0)
; *******************************************************
#include <IE.au3>
_IECreate("www.autoitscript.com", 1, 1, 0)
_IECreate("my.yahoo.com", 1, 1, 0)
_IECreate("www.google.com", 1, 1, 0)
; *******************************************************
; Example 3 - Attempt to attach to an existing browser displaying a particular website URL
; Create a new browser and navigate to that site if one does not already exist
; *******************************************************
#include <IE.au3>
$oIE = _IECreate("www.autoitscript.com", 1)
; Check @extended return value to see if attach was successful
If @extended Then
MsgBox(0, "", "Attached to Existing Browser")
Else
MsgBox(0, "", "Created New Browser")
EndIf
; *******************************************************
; Example 4 - Create an empty browser window and populate it with custom HTML
; *******************************************************
#include <IE.au3>
$oIE = _IECreate()
Local $sHTML = "<h1>Hello World!</h1>"
_IEBodyWriteHTML($oIE, $sHTML)
; *******************************************************
; Example 5 - Create an invisible browser window, navigate to a website,
; retrieve some information and Quit
; *******************************************************
#include <IE.au3>
$oIE = _IECreate("http://sourceforge.net", 0, 0)
; Display the innerText on an element on the page with a name of "sfmarquee"
Local $oMarquee = _IEGetObjByName($oIE, "sfmarquee")
MsgBox(0, "SourceForge Information", $oMarquee.innerText)
_IEQuit($oIE)
; *******************************************************
; Example 6 - Create a browser window attached to a new instance of iexplore.exe
; This is often necessary in order to get a new session cookie context
; (session cookies are shared among all browser instances sharing the same iexplore.exe)
; *******************************************************
#include <IE.au3>
ShellExecute("iexplore.exe", "about:blank")
WinWait("Blank Page")
$oIE = _IEAttach("about:blank", "url")
_IELoadWait($oIE)
_IENavigate($oIE, "www.autoitscript.com")