Jump to content
Sign in to follow this  
LIMITER

How to get get text from yahoo! mail page ?

Recommended Posts

LIMITER

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

Share this post


Link to post
Share on other sites
Nahuel

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

Share this post


Link to post
Share on other sites
LIMITER

THX !!! Do you know how to get that text from the YAHOO! MAIL BETA webpage ???

Share this post


Link to post
Share on other sites
Nahuel

Well I don't use that one... I don't know how to get it either.

Share this post


Link to post
Share on other sites
LIMITER

Well I don't use that one... I don't know how to get it either.

ok .. thx !

Share this post


Link to post
Share on other sites
Nahuel

ok .. thx !

Just look at the source code and use StringRegExp() If you have trouble then post that piece of code (the one that shows in bold the unread messages) and I'll help you.

Share this post


Link to post
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
Sign in to follow this  

×