Jump to content

How to get get text from yahoo! mail page ?


LIMITER
 Share

Recommended Posts

Hi all ! I have a script which logins to yahoo mail ... How can i get the "You have 0 unread messages" text ? (that text in bold)

I tried with ie_bodyreadtext ... but it returns blank

I tried also with ie_bodyreadhtml ... also returns blank

and i even used controlgetext ... that also returned blank ...

THX !

#include <GUIConstants.au3>
#include <IE.au3>
#include <String.au3>
#NoTrayIcon

#Region ### START Koda GUI section ### Form=
$gui = GUICreate("Yahoo! Mail Checker - © 2008 L|M|TER", 270, 90, 193, 125)
$id = GUICtrlCreateInput("", 65, 5, 121, 17)
$text = GUICtrlCreateLabel("Yahoo! ID :", 5, 5, 58, 17)
$text1 = GUICtrlCreateLabel("Password :", 5, 25, 56, 17)
$pass = GUICtrlCreateInput("", 65, 25, 121, 17)
$beta = GUICtrlCreateRadio("Yahoo! Mail Beta", 5, 50, 103, 17)
$classic = GUICtrlCreateRadio("Yahoo! Mail Classic", 110, 50, 113, 17)
$result = GUICtrlCreateLabel("Welcome To Yahoo! Mail Checker ! - L|M|TER", 5, 70, 223, 17)
$chk = GUICtrlCreateButton("Check !", 190, 5, 75, 35, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $chk
            Call("check")
    EndSwitch
WEnd

Func check()
    $ie = _IECreate ("http://mail.yahoo.com")
    $hwnd = _IEPropertyGet($ie, "hwnd")
    $oForm = _IEFormGetObjByName ($ie, "login_form")
    $oId = _IEFormElementGetObjByName ($oForm, "login")
    $oPass = _IEFormElementGetObjByName ($oForm, "passwd")
    $idt = GUICtrlRead($id)
    $passt = GUICtrlRead($pass)
    _IEAction($oId, "focus")
    Sleep(250)
    ControlSend($hwnd, "", "Internet Explorer_Server1", $idt)
    _IEAction($oPass, "focus")
    Sleep(250)
    ControlSend($hwnd, "", "Internet Explorer_Server1", $passt)
    ControlSend($hwnd, "", "Internet Explorer_Server1", "{ENTER}")
    _IELoadWait($ie)
EndFunc
Link to comment
Share on other sites

This works for me:

Func check()
    $ie = _IECreate ("http://mail.yahoo.com")
    $hwnd = _IEPropertyGet($ie, "hwnd")
    $oForm = _IEFormGetObjByName ($ie, "login_form")
    $oId = _IEFormElementGetObjByName ($oForm, "login")
    $oPass = _IEFormElementGetObjByName ($oForm, "passwd")
    $idt = GUICtrlRead($id)
    $passt = GUICtrlRead($pass)
    _IEAction($oId, "focus")
    Sleep(250)
    ControlSend($hwnd, "", "Internet Explorer_Server1", $idt)
    _IEAction($oPass, "focus")
    Sleep(250)
    ControlSend($hwnd, "", "Internet Explorer_Server1", $passt)
    ControlSend($hwnd, "", "Internet Explorer_Server1", "{ENTER}")
    _IELoadWait($ie)
    
    ;Nahuel's part:==
    $html=_IEBodyReadHTML($IE)
    $Test= StringRegExp($html,'(?i)mail16_1.gif(.*?)<b>(.*?)</b>:<br>',1) 
    MsgBox(0,"","You have: " & $Test[1])
    ;=================
EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...