Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Googler


Сообщения: 3665
Благодарности: 1563

Профиль | Отправить PM | Цитировать


Цитата DENoszone:
берет тайтл с яндекса и вставляет в поиск нигмы »
как вариант:
Код: Выделить весь код
#include <IE.au3>

$oIE = _IECreate("http://www.yandex.ru/yandsearch?random=071215722&stype=www&randomtext=1&lr=187", 0, 0, 0)
_IENavigate ($oIE, "http://www.yandex.ru/yandsearch?random=071215722&stype=www&randomtext=1&lr=187")

$sTitle = _IEPropertyGet($oIE, "title")
$sTextFind = StringStripWS(StringReplace(_IEPropertyGet($oIE, "title"),"Яндекс:", ""), 3)

$oIE = _IECreate("http://nigma.ru", 0, 1, 0, 0)
WinSetState("", "", @SW_MAXIMIZE)
_IELoadWait($oIE)

$oForm = _IEFormGetCollection($oIE, 0)
$oElement = _IEFormElementGetObjByName($oForm, "s")
_IEFormElementSetValue($oElement, $sTextFind)
_IEFormSubmit($oForm)
тот же вариант, оптимизированный по скорости загрузки:
Код: Выделить весь код
#include <IE.au3>

_IEErrorHandlerRegister ("MyErrFunc")

$oIE = _IECreate("http://www.yandex.ru/yandsearch?random=071215722&stype=www&randomtext=1&lr=187", 0, 0, 0)
_IENavigate ($oIE, "http://www.yandex.ru/yandsearch?random=071215722&stype=www&randomtext=1&lr=187", 0)
Do
    Sleep(100)
    $iError = 0
    $sTitle = _IEPropertyGet($oIE, "title")
Until $iError=0

$sTextFind = StringStripWS(StringReplace(_IEPropertyGet($oIE, "title"),"Яндекс:", ""), 3)
$oIE = _IECreate("http://nigma.ru", 0, 1, 0, 0)
WinSetState("", "", @SW_MAXIMIZE)
Do
    Sleep(100)
    $oForm = _IEFormGetCollection($oIE, 0)
Until @error=0
Do
    Sleep(100)
    $oElement = _IEFormElementGetObjByName($oForm, "s")
Until @error=0

_IEFormElementSetValue($oElement, $sTextFind)
_IEFormSubmit($oForm)

Func MyErrFunc()
    $iError = $oIEErrorHandler.number
EndFunc

Отправлено: 15:50, 06-04-2008 | #396