Sign in to follow this  
Followers 0
Oldschool

IE snippet help

10 posts in this topic

http://quadryders.com/phpcc/snippet.php?sid=84

This snippet does not work...

I get an error:

C:\\HotMailSendMessage.au3 (28) : ==> Variable used without being declared.:

_IEAction($o_NewMessage, "click")

_IEAction(^ ERROR

I'm afraid I don't undertand this whole statement:

$o_Links = _IELinkGetCollection($o_IE)
     For $o_Link In $o_Links
          If $o_Link.tabIndex = 1 Then
               $o_NewMessage = $o_Link
                  
               ExitLoop
          EndIf
     Next
 
     If Not IsObj($o_NewMessage) Then Exit
 
     _IEAction($o_NewMessage, "click")
     _IELoadWait($o_IE)

Share this post


Link to post
Share on other sites



Well... that script is a year old.. hotmail has changed a lot.

Share this post


Link to post
Share on other sites

Place this at the top of your code and watch the SciTe console... it will help you debug:

#AutoIt3Wrapper_run_debug_mode=Y

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

What a nasty site to automate. This works for classic view...

#include <IE.au3>

_HotmailSendMessage("your-email@hotmail.com", "yourpassword", "someone@somewhere.com", "Test Subject", "Test Message")

;===============================================================================
;
; Function Name:   _HotmailSendMessage
; Description:      Send a message using your hotmail account
; Parameter(s):     $s_Email - Your hotmail account name
;                   $s_Password - Your hotmail account password
;                   $s_To - The recipient of the message
;                   $s_Subject - The subject of the message
;                   $s_Body - The body of the message
; Requirement(s):   You must use classic view
; Return Value(s):
; Author(s):    big_daddy
;
;===============================================================================
;
Func _HotmailSendMessage($s_Email, $s_Password, $s_To, $s_Subject, $s_Body)
    $o_IE = _IECreate("http://hotmail.com", 0, 1)
    _IELinkClickByText($o_IE, "Sign in with a different account")
    $o_Form = _IEFormGetObjByName($o_IE, "f1")
    $o_Name = _IEFormElementGetObjByName($o_Form, "login")
    $o_Pass = _IEFormElementGetObjByName($o_Form, "passwd")

    _IEFormElementSetValue($o_Name, $s_Email)
    _IEFormElementSetValue($o_Pass, $s_Password)
    _IEFormSubmit($o_Form, 0)
    _IELoadWait($o_IE, 500)

    If StringInStr(_IEBodyReadText($o_IE), "Please try again") Then
        MsgBox(0, "Error", "The e-mail address or password is incorrect.")
        Return 0
    EndIf

    _IEImgClick($o_IE, "i_newmessage_2.gif")
    _IELinkClickByText($o_IE, "Show plain text")

    $o_Form = _IEFormGetObjByName($o_IE, "aspnetForm")
    $o_To = _IEFormElementGetObjByName($o_Form, "fTo")
    $o_Subject = _IEFormElementGetObjByName($o_Form, "fSubject")
    $o_Body = _IEGetObjByName($o_IE, "fMessageBody")

    _IEFormElementSetValue($o_To, $s_To)
    _IEFormElementSetValue($o_Subject, $s_Subject)
    $o_Body.Value = $s_Body

    _IEImgClick($o_IE, "i_send.gif")
    _IELinkClickByText($o_IE, "Sign out")
    _IEQuit($o_IE)

EndFunc   ;==>_HotmailSendMessage
Edited by big_daddy

Share this post


Link to post
Share on other sites

What a nasty site to automate. This works for classic view...

Muchas Gracias Bid Daddy

Share this post


Link to post
Share on other sites

Muchas Gracias Bid Daddy

I can't guarantee how long it will work, but you're welcome.

Share this post


Link to post
Share on other sites

Most likely, not long. I'm surprised hotmail hasn't put in a CATCHPA for submitting email yet.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Could it be I dont have the right IE.au3

--> IE.au3 V2.3-1 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.3-1 Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch
--> IE.au3 V2.3-1 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType
--> IE.au3 V2.3-1 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType
--> IE.au3 V2.3-1 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType
--> IE.au3 V2.3-1 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType
--> IE.au3 V2.3-1 Error from function _IEFormSubmit, $_IEStatus_InvalidDataType
--> IE.au3 V2.3-1 Warning from function _IEImgClick, $_IEStatus_NoMatch
--> IE.au3 V2.3-1 Warning from function _IELinkClickByText, $_IEStatus_NoMatch
--> IE.au3 V2.3-1 Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch
--> IE.au3 V2.3-1 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType
--> IE.au3 V2.3-1 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType
--> IE.au3 V2.3-1 Warning from function _IEGetObjByName, $_IEStatus_NoMatch
--> IE.au3 V2.3-1 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType
--> IE.au3 V2.3-1 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType
--> IE.au3 V2.3-1 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType
--> IE.au3 V2.3-1 Warning from function _IEImgClick, $_IEStatus_NoMatch
--> IE.au3 V2.3-1 Warning from function _IELinkClickByText, $_IEStatus_NoMatch

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Nevermind that last one, it was the Classic View...

It works perfect.

$o_Form = _IEFormGetObjByName($o_IE, "f1")
    $o_Name = _IEFormElementGetObjByName($o_Form, "login")
    $o_Pass = _IEFormElementGetObjByName($o_Form, "passwd")

Are you getting the names of the objects by looking at the HTML source?

When I view the Gmail page source for instance, I don't see what I need...

_IELinkGetCollection($o_IE)
_IEImgGetCollection() 
_IELinkGetCollection() 
_IEFormElementGetCollection()

What's a good way to view the output of these commands when creating new IE code?

Edited by Oldschool

Share this post


Link to post
Share on other sites

Take a look at DebugBar in Dale's signature here.

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  
Followers 0