Sign in to follow this  
Followers 0
purplegirl

Emptying trash in Gmail page

14 posts in this topic

Hello!

I'm new to this forum as a member but have been lurking about here as a guest for three years and finally decided to join! :)

Anyway I'm having trouble trying to click a link inside my google gmail. I want to be able to log in, go to my gmail inbox, go to my Trash folder, click the select all button, and hit the delete forever button. The problem is that the _IELinkClickByText will not work. It gives me this error: --> IE.au3 V2.3-1 Warning from function _IELinkClickByText, $_IEStatus_NoMatch

I hope I provided enough information to help me out here; I haven't been able to find anything that could help me in the forum or in the help file so I've posted here. Here is my script so far:

$oIE = _IECreate("https://www.google.com/accounts/ManageAccount") ;----- This takes me to the google manage account page

_IELoadWait ($oIE)

$oForm = _IEFormGetCollection ($oIE, 0)

$oQuery = _IEFormElementGetCollection ($oForm, 1)

_IEFormElementSetValue ($oQuery, "email@gmail.com") ;----- Fill in my username/email

$oForm = _IEFormGetCollection ($oIE, 0)

$oQuery = _IEFormElementGetCollection ($oForm, 2) ;----- Fill in my password

_IEFormElementSetValue ($oQuery, "password")

$oObj=_IEGetObjByName($oIE, "PersistentCookie") ;----- Uncheck Remember me on this computer checkbox

_IEAction($oObj,"click")

$oObj=_IEGetObjByName($oIE, "signIn") ;----- Click the Sign In button

_IEAction($oObj,"click")

_IELoadWait ($oIE)

_IELinkClickByText ($oIE, "Gmail") ;----- Click on Gmail link on the Google Manage Account page

_IELoadWait ($oIE)

_IELinkClickByText ($oIE, "Trash") ;----- Once inside Gmail go to Trash page --> IE.au3 V2.3-1 Warning from function _IELinkClickByText, $_IEStatus_NoMatch

_IELoadWait ($oIE)

_IELinkClickByText ($oIE, "All") ;----- Once inside Gmail go to Trash page --> IE.au3 V2.3-1 Warning from function _IELinkClickByText, $_IEStatus_NoMatch

_IELoadWait ($oIE)

_IELinkClickByText ($oIE, "Delete Forever") ; ---- Can't figure out how to click the Delete Forever button --> IE.au3 V2.3-1 Warning from function _IELinkClickByText, $_IEStatus_NoMatch

_IELoadWait ($oIE)

$oIE = _IENavigate($oIE, "https://www.google.com/accounts/Logout") ; ---- Logout once I'm done

_IELoadWait ($oIE)

_IEQuit ($oIE) ; ---- Close when I'm done

Any extra info: Windows Vista Home Premium Service Pack 1

I rarely ever post on forums so If I I've posted this incorrectly or in the wrong place please let me know so I can fix it :P If more info or even a picture is needed let me know :P

Thanks to anyone who can help :D

Share this post


Link to post
Share on other sites



Bump

Anyone? I don't want to come off as impatient but i could use some help please :)

Share this post


Link to post
Share on other sites

Hi purplegirl,

i am (was) actually facing exactly the same problem. For some Reason all the Links are not accessable for me once i am logged in into my gmail account (BTW: thanks for the code example for logging in into gmail - which teached me how to get access to a form which has no name).

The workaround for this is to change the Standard View of your gmail account from "fancy" (with chat support and lots of other stuff) to "standard HTML" --> there is a link somewhere on the gmail page where you can change the standard view. Once this is changed you get standard HTML tags which can be easily accessed via ie.au3 functions.

good luck

Andreas

Share this post


Link to post
Share on other sites

Hi purplegirl,

i am (was) actually facing exactly the same problem. For some Reason all the Links are not accessable for me once i am logged in into my gmail account (BTW: thanks for the code example for logging in into gmail - which teached me how to get access to a form which has no name).

The workaround for this is to change the Standard View of your gmail account from "fancy" (with chat support and lots of other stuff) to "standard HTML" --> there is a link somewhere on the gmail page where you can change the standard view. Once this is changed you get standard HTML tags which can be easily accessed via ie.au3 functions.

good luck

Andreas

Wow I'm glad that my thrown together newbie script helped somebody! When I originally put it together I never considered using standard view; I will re-write the code and switch to standard html and see if it helps

Thank you very much :)

Share this post


Link to post
Share on other sites

Wow I'm glad that my thrown together newbie script helped somebody! When I originally put it together I never considered using standard view; I will re-write the code and switch to standard html and see if it helps

Thank you very much :P

Okie Doke here is my script and :) It works! Here it is so far

$oIE = _IECreate("https://www.google.com/accounts/Login")

_IELoadWait ($oIE)

$oForm = _IEFormGetCollection ($oIE, 0)

$oQuery = _IEFormElementGetCollection ($oForm, 0)

_IEFormElementSetValue ($oQuery, "user@gmail.com") ;----- Fill in my username/email

$oForm = _IEFormGetCollection ($oIE, 0)

$oQuery = _IEFormElementGetCollection ($oForm, 1) ;----- Fill in my password

_IEFormElementSetValue ($oQuery, "password")

$oObj=_IEGetObjByName($oIE, "PersistentCookie") ;----- Uncheck Remember me on this computer checkbox

_IEAction($oObj,"click")

$oObj=_IEGetObjByName($oIE, "signIn") ;----- Click the Sign In button

_IEAction($oObj,"click")

_IELoadWait ($oIE)

_IENavigate ($oIE, "http://mail.google.com/mail/h/") ;----- Switch to Standard Mode -- could keep it here but I like to switch back and forth

_IELoadWait ($oIE)

$oLinks = _IELinkGetCollection($oIE)

For $oLink in $oLinks

If StringInStr(String($oLink.innerText), "Trash") Then ;----- Click on Trash this code from DaleHohm clicks on Trash (I use this code for when numbers or other characters are added on to Trash -- a kind of wildcard function)

_IEAction($oLink, "click")

ExitLoop

EndIf

Next

_IELoadWait ($oIE)

$oObj=_IEGetObjByName($oIE, "t") ;----- Check mark any messages in the Trash

_IEAction($oObj,"click")

$oObj=_IEGetObjByName($oIE, "nvp_a_dl") ;----- Click the Delete button

_IEAction($oObj,"click")

_IELoadWait ($oIE)

_IENavigate($oIE, "https://www.google.com/accounts/Logout") ; ---- Logout once I'm done

_IELoadWait ($oIE)

_IEQuit ($oIE) ; ---- Close when I'm done

My only question now is how do u select more than one message or all messages in the Trash folder in HTML mode? Is it possible? This script so far only selects one message at a time...Any suggestions?

Share this post


Link to post
Share on other sites

I would avoid trying to check all of the messages in the trash and instead have your script click "Empty Trash Now".

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

It is all javascript in order for you to interact you must switch over to the HTML version of gmail.

http://mail.google.com/mail/?ui=html&zy=a
Edited by Thatsgreat2345

Share this post


Link to post
Share on other sites

It is all javascript in order for you to interact you must switch over to the HTML version of gmail.

http://mail.google.com/mail/?ui=html&zy=a
For me the "Empty Trash Now" link is Javascript only in Firefox, in IE6 its just a link.

Share this post


Link to post
Share on other sites

The link is not a link -- it is a SPAN that acts like a link. It is also in an iFrame (the 4th one on the page).

This works in my test... if the SPAN Id changes from 1ev4 then you'll need to get a collection of SPAN elements and loop through them lookin for the innerText you wnat.

#include <IE.au3>
$oIE = _IEAttach("Gmail - Trash")
$oFrame = _IEFrameGetCollection($oIE, 3)
$oSpan = _IEGetObjById($oFrame, "1ev4")
_IEAction($oSpan, "click")

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

The link is not a link -- it is a SPAN that acts like a link. It is also in an iFrame (the 4th one on the page).

This works in my test... if the SPAN Id changes from 1ev4 then you'll need to get a collection of SPAN elements and loop through them lookin for the innerText you wnat.

#include <IE.au3>
$oIE = _IEAttach("Gmail - Trash")
$oFrame = _IEFrameGetCollection($oIE, 3)
$oSpan = _IEGetObjById($oFrame, "1ev4")
_IEAction($oSpan, "click")

Dale

Hello! Its nice to hear from the person who gave me lots of ideas for my other scripts :)

I'm not really familiar with the _IEAttach command and how would I incorporate it into my current script.

Here is what it looks like now:

$oIE = _IECreate("https://www.google.com/accounts/Login")

_IELoadWait ($oIE)

$oForm = _IEFormGetCollection ($oIE, 0)

$oQuery = _IEFormElementGetCollection ($oForm, 0)

_IEFormElementSetValue ($oQuery, "user@gmail.com") ;----- Fill in my username/email

$oForm = _IEFormGetCollection ($oIE, 0)

$oQuery = _IEFormElementGetCollection ($oForm, 1) ;----- Fill in my password

_IEFormElementSetValue ($oQuery, "password")

$oObj=_IEGetObjByName($oIE, "PersistentCookie") ;----- Uncheck Remember me on this computer checkbox

_IEAction($oObj,"click")

$oObj=_IEGetObjByName($oIE, "signIn") ;----- Click the Sign In button

_IEAction($oObj,"click")

_IELoadWait ($oIE)

_IENavigate ($oIE, "http://mail.google.com/mail/h/") ;----- Switch to Standard Mode -- could keep it here but I like to switch back and forth

_IELoadWait ($oIE)

$oLinks = _IELinkGetCollection($oIE)

For $oLink in $oLinks

If StringInStr(String($oLink.innerText), "Trash") Then ;----- Click on Trash this code from DaleHohm clicks on Trash (I use this code for when numbers or other characters are added on to Trash -- a kind of wildcard function)

_IEAction($oLink, "click")

ExitLoop

EndIf

Next

_IELoadWait ($oIE)

$oIE = _IEAttach("Gmail - Trash")

$oFrame = _IEFrameGetCollection($oIE, 3) ;-------Select All Messages or hit delete forever button

$oSpan = _IEGetObjById($oFrame, "1ev4")

_IEAction($oSpan, "click")

_IELoadWait ($oIE)

_IENavigate($oIE, "https://www.google.com/accounts/Logout") ; ---- Logout once I'm done

_IELoadWait ($oIE)

_IEQuit ($oIE) ; ---- Close when I'm done

When I ran it like this I got these errors:

--> IE.au3 V2.3-1 Warning from function _IEFrameGetCollection, $_IEStatus_NoMatch

--> IE.au3 V2.3-1 Error from function _IEGetObjById, $_IEStatus_InvalidDataType

--> IE.au3 V2.3-1 Error from function _IEAction, $_IEStatus_InvalidDataType

What could I b doing wrong?

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

My code was written for "Standard Mode"... are you in HTML mode? Your comment in the code said ";----- Switch to Standard Mode", but I see it is actually the opposite of that. The Empty the Trash 'link' doesn't exist in the HTML mode.

Dale

p.s. please enclose your code in a block of [ autoit ]code[ /autoit ] (without the spaces) so that it formats more nicely.

Edited by DaleHohm

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

I'd say it would be better to use HTML view as you can see everything you need in the source, just saying.

Share this post


Link to post
Share on other sites

I'd say it would be better to use HTML view as you can see everything you need in the source, just saying.

I apologize I meant to say basic HTML mode (without all the bells and whisttles) not standard mode my script already sets it to HTML with this:

_IENavigate ($oIE, "http://mail.google.com/mail/h/") ;-----Basic HTML Mode -- sorry for the typo

Share this post


Link to post
Share on other sites

I apologize I meant to say basic HTML mode (without all the bells and whisttles) not standard mode my script already sets it to HTML with this:

_IENavigate ($oIE, "http://mail.google.com/mail/h/") ;-----Basic HTML Mode -- sorry for the typo

It is much easier to work in HTML mode since it loads faster but there is no button or link on the page that allows you to select all messages and delete them so my only option is set my script to delete them only one at a time...that is really a nuisance! Isn't there some way to select all messages in basic mode and click delete? The option is available in standard mode but I'd prefer to work in basic( no bells & whistles) since my script won't work in standard. Is there a workaround?

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