Perform any of a set of simple actions on the Browser
#include <IE.au3>
_IEAction ( ByRef $oObject, $sAction )
| $oObject | Object variable of an InternetExplorer.Application |
| $sAction | Action selection (see remarks) |
| Success: | 1. |
| Failure: | 0 and sets the @error flag to non-zero. |
| @error: | 2 ($_IEStatus_COMError) - COM Error in Object reference 3 ($_IEStatus_InvalidDataType) - Invalid Data Type 4 ($_IEStatus_InvalidObjectType) - Invalid Object Type 5 ($_IEStatus_InvalidValue) - Invalid Value |
| @extended: | Contains invalid parameter number |
| Action | Description |
| "back" | Navigates backward one item in the history list. |
| "blur" | Causes the element to lose focus, but does not set focus on the next element in the tab order. |
| "click" | Simulates a click on the specified element. |
| "copy" | Copies the current selection to the clipboard. |
| "cut" | Copies the current selection to the clipboard and then deletes it. |
| "delete" | Deletes the current selection. |
| "disable" | Disables the specified element. |
| "enable" | Enables the specified element. |
| "focus" | Causes the element to receive focus. |
| "forward" | Navigates forward one item in the history list. |
| "home" | Navigates to the current home or start page. |
| "invisible" | Sets an object state to hidden. |
| "paste" | Overwrites the contents of the clipboard on the current selection. |
| "print" | Opens the print dialog box so the user can print the current page. |
| "printdefault" | Print directly to default printer (no dialog) |
| "quit" | Closes the object. |
| "refresh" | Refreshes the current document. |
| "saveas" | Opens a dialog box to save the current Web page to a file. |
| "scrollintoview" | scrolls the document such that the specified element is visible. |
| "search" | Navigates to the current search page. |
| "selectall" | Selects the entire document. |
| "stop" | Cancels any pending navigation or download operation and stops any dynamic page elements, such as background sounds and animations. |
| "unselect" | Clears the current selection. |
| "visible" | Sets an object state to visible. |
; Open a browser with the "form" example, get a reference
; to the submit button by name and "click" it. This technique
; of submitting forms is useful because many forms rely on JavaScript
; code and "onClick" events on their submit button making _IEFormSubmit()
; not perform as expected
#include <IE.au3>
Local $oIE = _IE_Example("form")
Local $oSubmit = _IEGetObjByName($oIE, "submitExample")
_IEAction($oSubmit, "click")
_IELoadWait($oIE)
; Same as Example 1, except instead of using click, give the element focus
; and then use ControlSend to send Enter. Use this technique when the
; browser-side scripting associated with a click action prevents control
; from being automatically returned to your code.
#include <IE.au3>
Local $oIE = _IE_Example("form")
Local $oSubmit = _IEGetObjByName($oIE, "submitExample")
Local $hWnd = _IEPropertyGet($oIE, "hwnd")
_IEAction($oSubmit, "focus")
ControlSend($hWnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")
; Wait for Alert window, then click on OK
WinWait("", "ExampleFormSubmitted")
Sleep(2000)
ControlClick("", "ExampleFormSubmitted", "[CLASS:Button; TEXT:OK; Instance:1;]")
Sleep(2000)
_IEQuit($oIE)