How to automate a Web-Login ? (Requires IE)
http://www.autohotke...p?p=67646#67646
I am posting here an experimental script I wrote for automating AHK-Forum Login.
Alter the first three variables correctly to get working resultsUserName=ahkuser PassWord=ahkuser IExplore=C:\Program Files\Internet Explorer\iexplore.exe TempFile=%A_Temp%\AHK-F.htm MemVar= ( Join <head>`n<title>AHK.Automated.Login.AHK-Forum</title>`n</head>`n<bodyùbgcolor="#E 5E5E5"ùtext="#000000"ùlink="#006699"ùvlink="#5493B4"ùleftmargin="15"ùtopmargin=" 5"ùmarginwidth="5"ùmarginheight="5">`n<aùname="top"></a>ù`n<tableùwidth="300"ùce llspacing="0"ùcellpadding="0"ùborder="0"ùalign="left">`nø<tr>ù`nö<tdùclass="body line"ùheight="134">ù`nô<formùaction="http://www.autohotkey.com/forum/login.php?s id="ùmethod="post"ùtarget="_top">`nò<tableùwidth="100`%"ùcellpadding="0"ùcellspa cing="0"ùborder="0"ùclass="forumline"ùalign="center">`nñù<tr>ù`nñ÷<tdùclass="row 1">ù`nñõ<tableùborder="0"ùcellpadding="2"ùcellspacing="2"ùwidth="100`%">`nñó<tr> ù`nññ<tdùwidth="70`%">ù`nññø<inputùtype="text"ùclass="post"ùname="username"ùvalu e="u.s.e.r.n.a.m.e"ùsize="25"ùmaxlength="40"ù/>`nññ</td>`nñó</tr>`nñó<tr>ù`nññ<t dùwidth="70`%">ù`nññø<inputùtype="password"ùvalue="p.a.s.s.w.o.r.d"ùclass="post" ùname="password"ùsize="25"ùmaxlength="32"ù/>`nññ</td>`nñó</tr>`nñó<trùalign="cen ter">ù`nññ<td>ù`nññø<divùalign="left"><spanùclass="gen">ù`nññö<inputùtype="check box"ùcheckedùname="autologin"ù/>`nññö</span>ù`nññö<inputùtype="hidden"ùname="red irect"ùvalue=""ù/>`nññö<inputùtype="submit"ùname="login"ùclass="mainoption"ùvalu e="Logùin"ù/>`nññø</div>`nññ</td>`nñó</tr>`nñõ</table>`nñ÷</td>`nñù</tr>`nò</tab le>`nô</form>`nô<divùalign="center"></div>`nö</td>`nø</tr>`n</table>`n</body>`n< /html> ) MemVar:=ExpandSpaces(MemVar) ; uncompress the spaces StringReplace, MemVar, MemVar, u.s.e.r.n.a.m.e, %UserName% StringReplace, MemVar, MemVar, p.a.s.s.w.o.r.d, %PassWord% FileErase(TempFile) FileAppend, % MemVar, %TempFile% MemVar= Run, %IExplore% "%TempFile%", , MAX WinWaitActive, AHK.Automated.Login.AHK-Forum IEID1:=WinExist("AHK.Automated.Login.AHK-Forum") ControlSend, Internet Explorer_Server1, {Tab 5}{Enter}, ahk_id %IEID1% Sleep, 2000 FileErase(TempFile) Return ExpandSpaces(MemVar,Asc=240) { Loop, 9 StringReplace, MemVar, MemVar, % Chr(Asc+A_Index), % Space(10-a_Index), All Return MemVar } Space(Width) { Loop,%Width% Space=% Space Chr(32) Return Space } FileErase(FileName) { ;Thanks to PhiLho: http://www.autohotkey.com/forum/viewtopic.php?p=52564#52564 handle:=DllCall("CreateFile", "Str",FileName, "UInt",0x40000000 ,"UInt",3 , "UInt",0 , "UInt",5 , "UInt",0 , "UInt",0) DllCall("CloseHandle", "UInt", handle) FileRecycle, %FileName% ; Change this to: FileDelete, %FileName% IfLessOrEqual, handle, 0, Return, 0 Return 1 }
Right click & save this file: ahkloginhtml.txt.txt to see the actual HTML
I will post the text compression technique (used for encoding the HTML text) in a seperate topic.
Meanwhile, let me know if someone wants a similar auto-login script for GMail.
Regards,

[How to] Automate a Web-Login (Requires IE)
Started by
SKAN
, Jul 11 2006 02:25 PM
17 replies to this topic
#1
-
Posted 11 July 2006 - 02:25 PM
![[How to] Automate a Web-Login (Requires IE): post #1](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
Hi there,
I really would like the other script you mentioned, to automate Gmail login. And ideally just something I could customize to work out login on anything (I assume there are tab indexes or mouse click locations or something custom to each).
I am brand new to AHK so still basically an idiot, but the web login and gmail login were early on my list of ideal things to start with. :-)
Thanks!
Palyne
I really would like the other script you mentioned, to automate Gmail login. And ideally just something I could customize to work out login on anything (I assume there are tab indexes or mouse click locations or something custom to each).
I am brand new to AHK so still basically an idiot, but the web login and gmail login were early on my list of ideal things to start with. :-)
Thanks!
Palyne
#2
-
Posted 21 October 2011 - 01:21 PM
![[How to] Automate a Web-Login (Requires IE): post #2](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
Edit by SKAN: Requires AHK_L
Welcome to the forum RedCairo. You can use this;I really would like... ...to automate Gmail login.
GMailLogIn("[color=red]WriteYourUserNameHere[/color]","[color=red]WriteYourPasswordHere[/color]") GMailLogIn(UserName,Password) { pwb := ComObjCreate( "InternetExplorer.Application") pwb.Visible := True pwb.Navigate( "http://mail.google.com/mail") While, (pwb.ReadyState <> 4) Sleep, 100 pwb.document.all.Email.value := UserName pwb.document.all.Passwd.value := Password pwb.document.all.signIn.click }
#3
-
Posted 21 October 2011 - 01:35 PM
![[How to] Automate a Web-Login (Requires IE): post #3](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
How to automate a Web-Login ? (Requires IE)
http://www.autohotke...p?p=67646#67646
I am posting here an experimental script I wrote for automating AHK-Forum Login.
Alter the first three variables correctly to get working resultsUserName=ahkuser PassWord=ahkuser IExplore=C:\Program Files\Internet Explorer\iexplore.exe TempFile=%A_Temp%\AHK-F.htm MemVar= ( Join <head>`n<title>AHK.Automated.Login.AHK-Forum</title>`n</head>`n<bodyùbgcolor="#E 5E5E5"ùtext="#000000"ùlink="#006699"ùvlink="#5493B4"ùleftmargin="15"ùtopmargin=" 5"ùmarginwidth="5"ùmarginheight="5">`n<aùname="top"></a>ù`n<tableùwidth="300"ùce llspacing="0"ùcellpadding="0"ùborder="0"ùalign="left">`nø<tr>ù`nö<tdùclass="body line"ùheight="134">ù`nô<formùaction="http://www.autohotkey.com/forum/login.php?s id="ùmethod="post"ùtarget="_top">`nò<tableùwidth="100`%"ùcellpadding="0"ùcellspa cing="0"ùborder="0"ùclass="forumline"ùalign="center">`nñù<tr>ù`nñ÷<tdùclass="row 1">ù`nñõ<tableùborder="0"ùcellpadding="2"ùcellspacing="2"ùwidth="100`%">`nñó<tr> ù`nññ<tdùwidth="70`%">ù`nññø<inputùtype="text"ùclass="post"ùname="username"ùvalu e="u.s.e.r.n.a.m.e"ùsize="25"ùmaxlength="40"ù/>`nññ</td>`nñó</tr>`nñó<tr>ù`nññ<t dùwidth="70`%">ù`nññø<inputùtype="password"ùvalue="p.a.s.s.w.o.r.d"ùclass="post" ùname="password"ùsize="25"ùmaxlength="32"ù/>`nññ</td>`nñó</tr>`nñó<trùalign="cen ter">ù`nññ<td>ù`nññø<divùalign="left"><spanùclass="gen">ù`nññö<inputùtype="check box"ùcheckedùname="autologin"ù/>`nññö</span>ù`nññö<inputùtype="hidden"ùname="red irect"ùvalue=""ù/>`nññö<inputùtype="submit"ùname="login"ùclass="mainoption"ùvalu e="Logùin"ù/>`nññø</div>`nññ</td>`nñó</tr>`nñõ</table>`nñ÷</td>`nñù</tr>`nò</tab le>`nô</form>`nô<divùalign="center"></div>`nö</td>`nø</tr>`n</table>`n</body>`n< /html> ) MemVar:=ExpandSpaces(MemVar) ; uncompress the spaces StringReplace, MemVar, MemVar, u.s.e.r.n.a.m.e, %UserName% StringReplace, MemVar, MemVar, p.a.s.s.w.o.r.d, %PassWord% FileErase(TempFile) FileAppend, % MemVar, %TempFile% MemVar= Run, %IExplore% "%TempFile%", , MAX WinWaitActive, AHK.Automated.Login.AHK-Forum IEID1:=WinExist("AHK.Automated.Login.AHK-Forum") ControlSend, Internet Explorer_Server1, {Tab 5}{Enter}, ahk_id %IEID1% Sleep, 2000 FileErase(TempFile) Return ExpandSpaces(MemVar,Asc=240) { Loop, 9 StringReplace, MemVar, MemVar, % Chr(Asc+A_Index), % Space(10-a_Index), All Return MemVar } Space(Width) { Loop,%Width% Space=% Space Chr(32) Return Space } FileErase(FileName) { ;Thanks to PhiLho: http://www.autohotkey.com/forum/viewtopic.php?p=52564#52564 handle:=DllCall("CreateFile", "Str",FileName, "UInt",0x40000000 ,"UInt",3 , "UInt",0 , "UInt",5 , "UInt",0 , "UInt",0) DllCall("CloseHandle", "UInt", handle) FileRecycle, %FileName% ; Change this to: FileDelete, %FileName% IfLessOrEqual, handle, 0, Return, 0 Return 1 }
Right click & save this file: ahkloginhtml.txt.txt to see the actual HTML
I will post the text compression technique (used for encoding the HTML text) in a seperate topic.
Meanwhile, let me know if someone wants a similar auto-login script for GMail.
Regards,
can this work in Opera and in any website?
#5
-
Posted 27 November 2011 - 06:41 PM
![[How to] Automate a Web-Login (Requires IE): post #5](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
can this work in Opera and in any website?
I have not used Opera.
The HTML template should be different for other sites.
I would not recommend this. COM is best suited for web automation.
#6
-
Posted 27 November 2011 - 07:59 PM
![[How to] Automate a Web-Login (Requires IE): post #6](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
Hello everyone! I'm newbie here. I really don't understand how this thing works but I really like the idea of automating a web-login.
Can anyone explain how this thing works please. Any help is highly appreciated. Thanks.
Can anyone explain how this thing works please. Any help is highly appreciated. Thanks.

#7
-
Posted 09 June 2012 - 07:50 AM
![[How to] Automate a Web-Login (Requires IE): post #7](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
Basically it creates a fake html page with the needed stuff to log in to the forum and it sends the information to the autohotkeys forum. The forum doesn't know the difference because everything it needs to log you in is there.
#8
-
Posted 21 July 2012 - 10:22 PM
![[How to] Automate a Web-Login (Requires IE): post #8](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
Thanks very much for this tutorial! I try this way end hope to succed!
#9
-
Posted 05 September 2012 - 01:09 PM
![[How to] Automate a Web-Login (Requires IE): post #9](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
I'm quite new to this and I've put in several hours in the past to get something similar for this website from my school where we have to login with our emailadress and pw every singe time as it doesnt save anything. Could anyone help me out here? The website is https://blackboard.a...al/frameset.jsp
#11
-
Posted 23 November 2012 - 08:28 PM
![[How to] Automate a Web-Login (Requires IE): post #11](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
The top post is very old and although it probably still works is is not the best method anymore, the one a few posts down http://www.autohotke...ie/#entry461378 is using the latest ahk (sometimes still referred to as ahk_l) and COM which should work a lot better PROVIDED you use Internet Explorer. COM is only for IE.
Looking at the url your site uses a frameset which makes it a bit harder, you need to download the IWB2 learner http://www.autohotke...r-iwebbrowser2/ to help you figure out what values to use. And then start reading here http://www.autohotke...l-for-webpages/
Looking at the url your site uses a frameset which makes it a bit harder, you need to download the IWB2 learner http://www.autohotke...r-iwebbrowser2/ to help you figure out what values to use. And then start reading here http://www.autohotke...l-for-webpages/
#12
-
Posted 23 November 2012 - 11:03 PM
![[How to] Automate a Web-Login (Requires IE): post #12](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
Heres a video of how you can make a AHk/COM "login script" work for new sites
http://www.youtube.com/watch?v=0lgTc9hBMs8
Hope it helps

http://www.youtube.com/watch?v=0lgTc9hBMs8
Loginname := "Your Login name here" Password := "Your Password here" URL := WB := ComObjCreate("InternetExplorer.Application") WB.Visible := True WB.Navigate(URL) While wb.readyState != 4 || wb.document.readyState != "complete" || wb.busy ; wait for the page to load Sleep, 10 wb.document.getElementById("login").value := Loginname wb.document.getElementById("password").value := Password wb.document.getElementsByTagName("Button")[1].Click() While wb.readyState != 4 || wb.document.readyState != "complete" || wb.busy ; wait for the page to load Sleep, 10 Msgbox, Something like that i hope! return
Hope it helps
#13
-
Posted 24 November 2012 - 12:21 AM
![[How to] Automate a Web-Login (Requires IE): post #13](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
Morning.
I am not able to watch the video whilst at work, but I have searched and searched the web for a solution to a problem I am facing.
Please could somebody knock me up a script to log into the following website (or even just to auto type the name and password, the user could tick the box and accept)
https://online.espresso.co.uk/espresso/login/Authn/UserPassword
This is a for a behavioural school and they cannot type the long-winded username all the time, and it would be timewasting for the teacher to do it multiple times too.
I am not able to watch the video whilst at work, but I have searched and searched the web for a solution to a problem I am facing.
Please could somebody knock me up a script to log into the following website (or even just to auto type the name and password, the user could tick the box and accept)
https://online.espresso.co.uk/espresso/login/Authn/UserPassword
This is a for a behavioural school and they cannot type the long-winded username all the time, and it would be timewasting for the teacher to do it multiple times too.
#14
-
Posted 27 November 2012 - 09:16 AM
![[How to] Automate a Web-Login (Requires IE): post #14](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)
wb.document.all.j_username.value := Loginname
wb.document.all.j_password.value := Password
wb.document.getElementByID("checkbox").checked := True
wb.document.all.loginForm.submit()
Hope it helps
#15
-
Posted 27 November 2012 - 10:50 PM
![[How to] Automate a Web-Login (Requires IE): post #15](http://autohotkey.com/board/public/style_images/ortem/icon_share.png)