VBScript to login into Gmail account
WScript.Quit
Main
Function Main
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
Resolution = Screen_Resolution()
Width = Resolution(0)
Hight=
Resolution(1)
IE.Top = 0
IE.Left = 0
IE.Width = Width
IE.Height = Hight
IE.Navigate "http://www.google.com/mail"
Wait IE
With IE.Document
.getElementByID("Email").value = "<Username>"
.getElementByID("Passwd").value = "<Password>"
.getElementByID("gaia_loginform").submit
End With
End Function
Sub Wait(IE)
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
End Sub
Sub IE_OnQuit
On Error Resume Next
WScript.StdErr.WriteLine "IE closed before
script finished."
WScript.Quit
End Sub
Function Screen_Resolution()
Dim MyArray(1)
Set objWMIService = GetObject("Winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From
Win32_DesktopMonitor where DeviceID = 'DesktopMonitor1'",,0)
For Each objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeight
Next
MyArray(0) = intHorizontal
MyArray(1) = intVertical
Screen_Resolution
= MyArray
End Function
Comments
How find the value like(Email, passwd, gaia_loginform") in the above script.
and
How to write a script a to click on login button, which should work in all in login forms..?
To get the source code to a notepad, is there any HTML code
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate "https://accounts.google.com/signin/v2/identifier?flowName=GlifWebSignIn&flowEntry=ServiceLogin#"
IE.Visible = True
While IE.Busy
WScript.Sleep 50
Wend
Set ipf = IE.document.all.identifier
ipf.Value = "username"
WScript.Sleep 5000
Set ipf = IE.document.all.password
ipf.Value = "password"
end if