↑  ←  Описание функции


_IEFormGetCollection

Returns a collection object variable representing the Forms in the document or a single form by index.

#include <IE.au3>
_IEFormGetCollection(ByRef $o_object [, $i_index = -1])

Параметры

$o_object Переменная объекта InternetExplorer.Application, Window, Frame or iFrame object
$i_index [необязательный] specifies whether to return a collection or indexed instance
0 or positive integer returns an indexed instance
-1 = (по умолчанию) returns a collection

Возвращаемое значение

Успех:Возвращает an object variable with a collection of all forms in the document, @extended = form count
Ошибка:Возвращает 0 и устанавливает @error
@error:0 ($_IEStatus_Success) = Нет ошибок
3 ($_IEStatus_InvalidDataType) = Неверный тип данных
5 ($_IEStatus_InvalidValue) = Неверное значение
7 ($_IEStatus_NoMatch) = Нет совпадений
@extended:Содержит номер неверного параметра

См. также

_IEFormGetObjByName, _IEFormReset, _IEFormSubmit

Пример

; *******************************************************
; Пример 1 - Get a reference to a specific form by 0-based index,
;               in this case the first form on the page
; *******************************************************

#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetCollection ($oIE, 0)
$oQuery = _IEFormElementGetCollection ($oForm, 1)
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)

; *******************************************************
; Пример 2 - Get a reference to the collection of forms on a page,
;               and then loop through them displaying information for each
; *******************************************************

#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com")
$oForms = _IEFormGetCollection ($oIE)
MsgBox(4096, "Forms Info", "There are " & @extended & " forms on this page")
For $oForm In $oForms
    MsgBox(4096, "Form Info", $oForm.name)
Next

; *******************************************************
; Пример 3 - Get a reference to the collection of forms on a page,
;               and then loop through them displaying information for each
;               demonstrating use of form index
; *******************************************************

#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com")
$oForms = _IEFormGetCollection ($oIE)
$iNumForms = @extended
MsgBox(4096, "Forms Info", "There are " & $iNumForms & " forms on this page")
For $i = 0 to $iNumForms - 1
    $oForm = _IEFormGetCollection ($oIE, $i)
    MsgBox(4096, "Form Info", $oForm.name)
Next