Jump to content

Login Program for GMAIL


mjoshi
 Share

Recommended Posts

Hi ,

I have written this small program to log in to GMAIL;

#include <IE.au3>

Local $oUser, $oPass, $oSubmit, $oInput

$oIE = _IECreate ("www.gmail.com")

_IELoadWait($oIE)

If WinExists("Gmail: Email from Google") Then

WinSetState("Gmail: Email from Google", "", @SW_MAXIMIZE)

;get the htm source

Local $oInputs = _IETagNameGetCollection($oIE, "input")

;loop through elements and get the names of the text fields for user and pass

For $oInput In $oInputs

If $oInput.type = "text" And $oInput.name = "Email" Then $oInput.value = "XXXXXXX"

If $oInput.type = "password" And $oInput.name = "Passwd" Then $oInput.value = "XXXXXXXX"

Sleep(1200)

If $oInput.type = "checkbox" And $oInput.name = "PersistentCookie" Then Send("{SPACE}")

Sleep(1200)

If $oInput.type = "submit" And $oInput.name = "signIn" Then _IEAction($oInput, "click")

Next

EndIf

Send("{ENTER}")

But Somehow, the checkbox is not getting ticked.

I tried various formations like :

If $oInput.type = "checkbox" And $oInput.name = "PersistentCookie" Then _IEAction($oInput, "click")

and

If $oInput.type = "checkbox" And $oInput.name = "PersistentCookie" Then $oInput.value = "yes"/"True"

But it is not working.

Can someone let me know, what I am missing?

Link to comment
Share on other sites

  • Moderators

mjoshi,

Please do not bump your posts within 24 hours. :)

Remember this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually. ;)

And it is Christmas Day you know! :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hey mjoshi

Please put your code into [ autoit ] tags, otherwise my eyes bleed :)

I honestly can't help you because i think coders should use Firefox anyway, and i'm excited of the FF.au3 library, so you could send javascript commands to the browser ! Maybe the IE functions of AutoIt have something like that too.

Edited by ElFuego

My scripts: Logfile Snippet

Link to comment
Share on other sites

Hey mjoshi

Please put your code into [ autoit ] tags, otherwise my eyes bleed :)

#include <IE.au3>
Local $oUser, $oPass, $oSubmit, $oInput
$oIE = _IECreate ("www.gmail.com")
_IELoadWait($oIE)
If WinExists("Gmail: Email from Google") Then
  WinSetState("Gmail: Email from Google", "", @SW_MAXIMIZE)
  ;get the htm source
  Local $oInputs = _IETagNameGetCollection($oIE, "input")
  ;loop through elements and get the names of the text fields for user and pass
  For $oInput In $oInputs
   If $oInput.type = "text" And $oInput.name = "Email" Then $oInput.value = "XXXXXX"
  
   If $oInput.type = "password" And $oInput.name = "Passwd" Then $oInput.value = "XXXXXXX"
    Sleep(1200)
   If $oInput.type = "checkbox" And $oInput.name = "PersistentCookie" Then Send("{SPACE}")
     Sleep(1200)
  
   If $oInput.type = "submit" And $oInput.name = "signIn" Then _IEAction($oInput, "click")
  
   Next
  EndIf
  Send("{ENTER}")

In the above code Checkbox is not getting ticked, and I feel Even the Submit button is not getting clicked as I have to send the

Send("{ENTER}") command at the end ;)

Edited by mjoshi
Link to comment
Share on other sites

i will give you a hint: check the order in which the inputs are found by checking the source. That will explain why the input box is not ticked i think (didn't test it). To check the checkbox i assume you need to use "enable" for IEAction function. check the help documentation.

Edited by cageman
Link to comment
Share on other sites

i will give you a hint: check the order in which the inputs are found by checking the source. That will explain why the input box is not ticked i think (didn't test it). To check the checkbox i assume you need to use "enable" for IEAction function. check the help documentation.

Great! That was some great thinking, We seem to be now a step closer, yes the Checkbox was described above the submit button in the source. But sadly, even after changing the sequence(basically removing submit button code line), it still is not working.

So my code now looks like :

#include <IE.au3>
Local $oUser, $oPass, $oSubmit, $oInput
$oIE = _IECreate ("www.gmail.com")
_IELoadWait($oIE)
If WinExists("Gmail: Email from Google") Then
  WinSetState("Gmail: Email from Google", "", @SW_MAXIMIZE)
  ;get the htm source
  Local $oInputs = _IETagNameGetCollection($oIE, "input")
  ;loop through elements and get the names of the text fields for user and pass
  For $oInput In $oInputs
   If $oInput.type = "text" And $oInput.name = "Email" Then $oInput.value = "xxxxxxxxxxxx"
   
   If $oInput.type = "password" And $oInput.name = "Passwd" Then $oInput.value = "xxxxxxxxxxx"
    Sleep(1200)
   If $oInput.type = "checkbox" And $oInput.name = "PersistentCookie" Then _IEAction($oInput, "enable")
     Sleep(1200)
   Next
  EndIf
  Send("{ENTER}")

But the checkbox is still not ticked. :)

Link to comment
Share on other sites

i will give you a hint: check the order in which the inputs are found by checking the source. That will explain why the input box is not ticked i think (didn't test it).

Okay I did some testing, I moved the line of Password field up, and the email field down, but the script was still working!

So we are now sure that the sequence of description in the source doesn't matter. :)

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...