Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Sign in to gmail automatically


  • Please log in to reply
44 replies to this topic
Andy
  • Guests
  • Last active:
  • Joined: --
You can use the free iMacros for Firefox add-on from http://www.iopus.com/imacros/firefox/ and record a macro (inside Firefox) that does this. Here is my own gmail login macro (user name and password removed!):

URL GOTO=http://www.gmail.com
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:ServiceLoginAuth ATTR=ID:Email CONTENT=YourUserNameHere
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ACTION:ServiceLoginAuth ATTR=ID:Passwd CONTENT=YourPasswordHere
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:ServiceLoginAuth ATTR=NAME:null&&VALUE:Sign<SP>in

If you want to integrate it with AHK, please make sure that Firefox is running before calling the macro

run, http://run.imacros.net/?m=gmaillogin.iim


daonlyfreez
  • Members
  • 995 posts
  • Last active: Jan 23 2013 08:16 AM
  • Joined: 16 Mar 2005
Here is the code for Internet Explorer and Opera (currently don't have FF installed). It uses the addressbar of the browser and JavaScript.

#Persistent

yourUsername = ausername
yourPassword = apassword

IEPath = %A_ProgramFiles%\Internet Explorer\iexplore.exe
IEGoogleTitle = Welcome to Google Mail - Microsoft Internet Explorer

OPPath = %A_ProgramFiles%\Opera\Opera.exe
OPGoogleTitle = Welcome to Google Mail - Opera

FFPath =
FFGoogleTitle =

JS = 
(Join LTrim
  javascript:with(document.forms[0]){elements[5].value="%yourUsername%";
  elements[6].value="%yourPassword%";submit();void(0)} 
)

Return ; End of AutoExecute section


F1:: ; Internet Explorer
  Run, %IEPath% http://www.gmail.com
  WinWait %IEGoogleTitle% ahk_class IEFrame
  Sleep, 3000 ; wait 3 seconds for the page to load
  ControlSetText, Edit1, %JS%, %IEGoogleTitle% ahk_class IEFrame
  Sleep, 500 ; wait a bit
  ControlSend, Edit1, {Enter}, %IEGoogleTitle% ahk_class IEFrame
Return

F2:: ; Firefox

Return


F3:: ; Opera
  prevClip := Clipboard
  Run, %OPPath% http://www.gmail.com
  WinWait %OPGoogleTitle% ahk_class OpWindow
  Sleep, 3000 ; wait 3 seconds for the page to load
  WinActivate %OPGoogleTitle% ahk_class OpWindow
  Send {F8} ; sets focus to addressbar
  Sleep, 500 ; wait a bit
  WinActivate %OPGoogleTitle% ahk_class OpWindow
  Clipboard := JS
  Send ^v
  Sleep, 500 ; wait a bit
  Send {Enter}
  Clipboard := prevClip
Return

Posted Image mirror 1mirror 2mirror 3ahk4.me • PM or Posted Image

anidealworld
  • Members
  • 2 posts
  • Last active: Aug 06 2007 03:09 PM
  • Joined: 24 Jul 2007
does this work for IE7, it doesn't appear to.

daonlyfreez
  • Members
  • 995 posts
  • Last active: Jan 23 2013 08:16 AM
  • Joined: 16 Mar 2005
It should, try changing the detected title:

IEGoogleTitle = Welcome to Google Mail - Microsoft Internet Explorer

IEGoogleTitle = Welcome to Google Mail - [color=red]Windows [/color]Internet Explorer

Posted Image mirror 1mirror 2mirror 3ahk4.me • PM or Posted Image

anidealworld
  • Members
  • 2 posts
  • Last active: Aug 06 2007 03:09 PM
  • Joined: 24 Jul 2007
I altered it a little and it worked.

That must have been it- thanks!

My only other question is how did you determine the document.forms[0]
and elements[5].value part? Specifically the numbers in the array?

javascript:with(document.forms[0]){elements[5].value="%yourUsername%";
  elements[6].value="%yourPassword%";submit();void(0)}


engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
search the forum for javascript and bookmarklet. I think there is a quick tutorial for how to determine the indexes.

viciouskinid
  • Members
  • 136 posts
  • Last active: Jul 26 2008 01:34 AM
  • Joined: 23 Jun 2007
can someone help me send this to firefox

javascript:with(document.forms[0]){elements[6].value="%yourUsername%";elements[7].value="%yourPassword%";submit();void(0)}


i cant figure out how to do it.

engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
send, !d   ;go to address bar
send, javascript:with(document.forms[0]){elements[6].value="%yourUsername%";elements[7].value="%yourPassword%";submit();void(0)}

send, {enter}

You may need setkeydelay, or sleep

viciouskinid
  • Members
  • 136 posts
  • Last active: Jul 26 2008 01:34 AM
  • Joined: 23 Jun 2007

search the forum for javascript and bookmarklet. I think there is a quick tutorial for how to determine the indexes.


Cant find it really want to understand the index bit of the code. Can anyone help

engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
this post is from a useful thread:
<!-- m -->http://www.autohotke... ... ght=#92153<!-- m -->

tank
  • Administrators
  • 4345 posts
  • AutoHotkey Foundation
  • Last active: May 02 2019 09:16 PM
  • Joined: 21 Dec 2007
here is your answer to how to disect the form on any web page
list_elements=
(
var x=document.forms;
win=window.open("blank.htm","_blank);

for (var f=0;f<=x.length-1;f++)  {
 win.document.writeln("<table border=1 cellspacing=0>");
win.document.writeln("<tr><td>form");
  win.document.writeln("</td><td>name");
  win.document.writeln("</td><td>id");
  win.document.writeln("</td><td>action");
win.document.writeln("</td><td>OnSubmit");
 win.document.writeln("<tr><td>");
  win.document.writeln("<tr><td>" + f);
  win.document.writeln("</td><td> ");
  win.document.writeln(x[f].name);
  win.document.writeln("</td><td> ");
  win.document.writeln(x[f].id);
  win.document.writeln("</td><td> ");
  win.document.writeln(x[f].action);
  win.document.writeln("</td><td> ");
  win.document.writeln(x[f].OnSubmit);
  win.document.writeln("</td></tr>");

 win.document.writeln("</table>");

 win.document.writeln("<table border=1 cellspacing=0>");
win.document.writeln("<tr><td>Element");
  win.document.writeln("</td><td>name");
  win.document.writeln("</td><td>id");
  win.document.writeln("</td><td>value");
win.document.writeln("</td><td>type");
win.document.writeln("</td><td>onclick");
win.document.writeln("</td><td>onchange");
win.document.writeln("</td><td>innerHTML");
  win.document.writeln("</td></tr>");
var l=x[f].elements
for (var i=0;i<=l.length-1;i++)  
{
win.document.writeln("<tr><td>" + i);
win.document.writeln("</td><td>"+l[i].name);
win.document.writeln("</td><td>"+l[i].id);
win.document.writeln("</td><td>"+l[i].value);
win.document.writeln("</td><td>"+l[i].type);
win.document.writeln("</td><td>"+l[i].onClick);
win.document.writeln("</td><td>"+l[i].onChange);
win.document.writeln("</td><td>"+l[i].innerHTML);
win.document.writeln("</td></tr>");
 }

 win.document.writeln("</table>");
  }


 win.document.writeln("</table>");
 win.document.writeln("<table border=1 cellspacing=0>");
win.document.writeln("<tr><td>All links index");
  win.document.writeln("</td><td>href");
  win.document.writeln("</td><td>target");
  win.document.writeln("</td><td>innerHTML");
  win.document.writeln("</td><td>name");
  win.document.writeln("</td><td>id");
  win.document.writeln("</td><td>class");
  win.document.writeln("</td><td>onclick");
  win.document.writeln("</td></tr>");
var y=document.links;
for (var m=0;m<=y.length-1;m++)  {
  win.document.writeln("<tr><td>" + m);
  win.document.writeln("</td><td> ");
  win.document.writeln(y[m].href);
  win.document.writeln("</td><td> ");
  win.document.writeln(y[m].target);
  win.document.writeln("</td><td> ");
  win.document.writeln(y[m].innerHTML);
  win.document.writeln("</td><td> ");
  win.document.writeln(y[m].name);
  win.document.writeln("</td><td> ");
  win.document.writeln(y[m].id);
  win.document.writeln("</td><td> ");
  win.document.writeln(y[m].className);
  win.document.writeln("</td><td> ");
  win.document.writeln(y[m].onclick);
  win.document.writeln("</td></tr>");
}
 win.document.writeln("</table>");
)
InputBox,title,User Prompt,Enter the title or tab title for the Page you wish to get form info from
IE7_InjectJS(title, list_elements)
the function IE7_InjectJS is found here
<!-- m -->http://www.autohotke... ... 028#190028<!-- m -->
enjoy
Never lose.
WIN or LEARN.

tank
  • Administrators
  • 4345 posts
  • AutoHotkey Foundation
  • Last active: May 02 2019 09:16 PM
  • Joined: 21 Dec 2007
oh forgot once you get the form index do this
js=
(
document.forms(0).method='get';
document.forms(0).elements('submitbuttonname or index').click();
)
IE7_InjectJS(title, js) 

notice there is a nice neet query string the ?param=value¶m2=val...
find the param that matches the username feilds and the password feild and enter your username and pass for the value portion save the url in a shortcut and there you go
alternatively

js=
(
document.forms(0).elements('user name atribute or index').value='youruseridhere';
document.forms(0).elements('password name atribute or index').value='yourpasshere';
document.forms(0).elements('submitbuttonname or index'.click();
)
IE7_InjectJS(title, js) 

enjoy
Never lose.
WIN or LEARN.

viciouskinid
  • Members
  • 136 posts
  • Last active: Jul 26 2008 01:34 AM
  • Joined: 23 Jun 2007
I dont really get that. Can I have a working example please.

trik
  • Members
  • 1317 posts
  • Last active: Jun 11 2010 11:48 PM
  • Joined: 15 Jul 2007
It just uses JavaScript Injection to change the contents of the edit fields on the GMail Login page.

tank
  • Administrators
  • 4345 posts
  • AutoHotkey Foundation
  • Last active: May 02 2019 09:16 PM
  • Joined: 21 Dec 2007
while it is javascript injection it is nothing even similar to what is listed on that page
the functions i point to use mshtml to access the IWebBrowser2 interface

<!-- m -->http://msdn2.microso...y/aa752127.aspx<!-- m -->
<!-- m -->http://msdn2.microso.../aa752084(VS.85<!-- m -->).aspx
<!-- m -->http://msdn2.microso.../aa752052(VS.85<!-- m -->).aspx
<!-- m -->http://msdn2.microso.../ms531073(VS.85<!-- m -->).aspx#
<!-- m -->http://msdn2.microso.../ms536420(VS.85<!-- m -->).aspx
Never lose.
WIN or LEARN.