Что нового

Правильная реакция _IE на ввод данных

bulldog5293

Знающий
Сообщения
172
Репутация
10
Собственно название темы и есть мой вопрос, то есть я хочу узнать в чём могут быть мои ошибки. Сейчас пишу скрипт для ввода данных в окно IE, но столкнулся с тем что он не видит куда вбивать данные. Скрипт вот
Код:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.AU3>
#Region ### START Koda GUI section ### Form=
$_1 = GUICreate("NAC", 192, 223, -1, -1)
GUICtrlCreateLabel("логин", 84, 54, 62, 20)
$answer = GUICtrlCreateInput("", 20, 147, 150, 21)
GUICtrlCreateLabel("Password", 76, 87, 62, 20)
$passwd = GUICtrlCreateInput("", 4, 52, 62, 21)
$Adress = GUICtrlCreateInput("", 4, 80, 62, 21)
$Img = GUICtrlCreateInput("", 4, 108, 62, 21)
$Button_add = GUICtrlCreateButton("add", 119, 176, 62, 23, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Start", 55, 178, 62, 21, $WS_GROUP)
$Label1 = GUICtrlCreateLabel("адрес", 16, 120, 34, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
Case $Button2
_Otvet()
	EndSwitch
WEnd
Func  _Otvet()
	$oIE = _IECreate(GUICtrlRead($Adress), 1, 1);получение адреса из строки ввода
	$oIE = _IEAttach ($Adress = "Title")
	$oForm = _IEFormGetCollection($oIE, 1) ;порядковый номер формы логина и пароля на форуме
	$oLogin = _IEFormElementGetObjByName($oForm, "vb_login_username") ;обозначение объекта "логин" в форме
	$oPass = _IEFormElementGetObjByName($oForm, "vb_login_password"); обозначение объекта "пароль" в форме
	_IEFormElementSetValue($oLogin, GUICtrlRead($answer));сам факт введения логина, считанного из строки ввода
	_IEFormElementSetValue($oPass, GUICtrlRead($passwd));факт введения пароля из строки ввода
	_IEFormSubmit($oForm, 5)

EndFunc

Проблема в том что при вводе пароля он выходит на поиск по icq, а мне нада что бы из строки ввода сайта он заходил на сам сайт и вбивал те данные что в него введены, для эксперимента был выбран сайт http://www.ambrella.z-mega.ru/ ссылку что я использую http://www.ambrella.z-mega.ru/login.php?r=, подскажите где моя ошибка
 

CreatoR

Must AutoIt!
Команда форума
Администратор
Сообщения
8,671
Репутация
2,481
Re: _IE

bulldog5293 [?]
Собственно название темы и есть мой вопрос
Собственно название темы неприемлемо! Никакого вопроса в нём нет.

Читаем правила форума (п. Б.5):
Имя темы должно нести смысловую нагрузку (отражать суть вопроса/проблемы) - Темы с названием типа "Помагите" и "Пару вопросов", скорее всего, будут удалены. Правильно сформулированное название темы привлекает больше внимания, и шансы получить конкретный ответ увеличиваются.
 

Garrett

Модератор
Локальный модератор
Сообщения
3,999
Репутация
967
Тема старая, но всё же :smile:
Код:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("NAC", 339, 93, 194, 114)
$Label1 = GUICtrlCreateLabel("Login:", 18, 12, 33, 17)
$Login = GUICtrlCreateInput("", 51, 9, 121, 21)
$Label2 = GUICtrlCreateLabel("Pass:", 180, 12, 30, 17)
$Pass = GUICtrlCreateInput("", 210, 9, 121, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$Label3 = GUICtrlCreateLabel("Capcha:", 6, 66, 44, 17)
$Capcha = GUICtrlCreateInput("", 51, 63, 79, 21)
$Label4 = GUICtrlCreateLabel("Address:", 6, 39, 45, 17)
$Address = GUICtrlCreateInput("http://www.ambrella.z-mega.ru/login.php", 51, 36, 280, 21)
$Send = GUICtrlCreateButton("Send", 171, 63, 75, 21, 0)
$Add = GUICtrlCreateButton("Add", 255, 63, 75, 21, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
Case $Send
_Otvet()
    EndSwitch
WEnd
Func  _Otvet()
	
    $oIE = _IECreate(GUICtrlRead($Address))
    $oForm = _IEFormGetCollection($oIE, 0)
    $oLogin = _IEFormElementGetObjByName($oForm, "username")
    $oPass = _IEFormElementGetObjByName($oForm, "password")
    $oCode = _IEFormElementGetObjByName($oForm, "code")
    _IEFormElementSetValue($oLogin, GUICtrlRead($Login))
    _IEFormElementSetValue($oPass, GUICtrlRead($Pass))
    _IEFormElementSetValue($oCode, GUICtrlRead($Capcha))
    _IEFormSubmit($oForm, 5)

EndFunc
 
Верх