我的方法是通过判断网页地址来判断是否成功登录,是否需要重新登录的,LZ看有没有需要。Func _login()
$loginIE = _IECreate("http://o-mega.me/index")
$url=_IEPropertyGet($loginIE,"locationurl")
$oForms = _IEFormGetCollection ($loginIE)
$iNumForms = @extended
If $iNumForms=1 Then
$oForm=_IEFormGetCollection($loginIE,0)
$User=_IEFormElementGetObjByName($oForm,"username")
$pass=_IEFormElementGetObjByName($oForm,"password")
$answer=_IEFormElementGetObjByName($oForm,"answer_out")
$submit = _IEFormElementGetObjByName ($oForm, "go")
$str= _IEBodyReadHTML($loginIE)
$secStr=StringRegExp($str,'Security question:</DIV></DIV>(.*)= <INPUT',3)
If @error Then
Else
TrayTip("","怎么会显示我呢~~",5)
$num=StringStripWS($secStr[0],8)
$strNum=StringSplit($num,"+")
$NewNum=$strNum[1]+$strNum[2]
Sleep(200)
_IEFormElementSetValue($User,$surfUser)
Sleep(200)
_IEFormElementSetValue($pass,$surfPass)
Sleep(500)
_IEFormElementSetValue($answer,$NewNum)
Sleep(500)
_IEAction ($submit, "click")
Sleep(5000)
_IELinkClickByText($loginIE,"Surf ads")
EndIf
EndIf
Sleep(5000)
_IEQuit($loginIE)
EndFunc
|