Stilgar Posted September 9, 2009 Share Posted September 9, 2009 (edited) This is a auto-login function and login-function-generator for FireFox and the FF.au31) it tries to login on any web-page (it works at the first try on the most sites, except on the forum here )2) it creates a optimized login-function for the page; #FUNCTION# =================================================================== ; Name ..........: _FF_AutoLogin ; Description ...: Auto login for HTML-forms / Generator for login-functions ; AutoIt Version : V3.3.0.0 ; Requirement(s).: FF.au3 ; Syntax ........: _FF_AutoLogin($sUserName, $sPassWord[, $sURL = ""[, $sStatus = ""[, $sSubmitMode = "keypress"[, $iMode = 0[, $iFormOffset = 0]]]]]) ; Parameter(s): .: $sUserName - ; $sPassWord - ; $sURL - Optional: (Default = "") : login page ; $sStatus - Optional: (Default = "") : Message to search on the web-page if the login was successful ; $sSubmitMode - Optional: (Default = "keypress") : if any methode fails the next in the list is tried ; | keypress ; | click ; | submit ; | off (fills only the inputs) ; $iMode - Optional: (Default = 0) : login-only ; | 1: login and returns login-function ; $iFormOffset - Optional: (Default = 0) : offset for some sites, with multiple password-inputs ; Return Value ..: Success - 1 / string (function) ; Failure - 0 ; Author(s) .....: Thorsten Willert ; Date ..........: Wed Sep 09 22:40:30 CEST 2009 ; Version .......: 3.2 ; ==============================================================================Examples:#include <FF.au3> _FFConnect() ; logins here at the forum and creates a login script MsgBox(0, "", _FF_AutoLogin("Username", "Password", "www.autoitscript.com/forum/index.php?app=core&module=global§ion=login", "login was successful", "submit", 1, 1)) ; login only If _FF_AutoLogin("Username", "Password", "www.autoitscript.com/forum/index.php?app=core&module=global§ion=login", "login was successful", "submit", 0, 1) Then MsgBox(0,"","Login was successful") ; login on the most other sites: If _FF_AutoLogin("Username", "Password", "http://example.com", "successful") Then ;.....The function:_FF_AutoLogin Edited November 13, 2009 by Stilgar karudish and nirmalsalem 2 jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
gseller Posted September 10, 2009 Share Posted September 10, 2009 Looks interesting, would love to see a working example? Link to comment Share on other sites More sharing options...
Stilgar Posted September 10, 2009 Author Share Posted September 10, 2009 (edited) Looks interesting, would love to see a working example? Doesn't the examples work for you? Oh I see you must change "password and "username" for the autoitscript.com example Why don't you try it? What would you see? An example have only two lines (+includes) #include <FF.au3> #include "_FF_AutoLogin.au3" _FFConnect() _FF_AutoLogin("Username", "Password", "http://ff-au3-example.thorsten-willert.de/") that's all. OK this one throws an 404-page Edited September 10, 2009 by Stilgar jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
Stilgar Posted September 18, 2009 Author Share Posted September 18, 2009 Updated to V3.3: - optimized the generated script - added Default-keyword for some parameters - some other small changes jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
Stilgar Posted November 3, 2009 Author Share Posted November 3, 2009 Updated to V3.4: - added support for <input type='image' ...> jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
Stilgar Posted November 7, 2009 Author Share Posted November 7, 2009 V4.0: - updated for FF.au3 >V0.6 jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
lbw87 Posted November 13, 2009 Share Posted November 13, 2009 I'm getting a _FFDispatchEvent error when checking syntax. Here's my code and a screenshot...am I doing something wrong?#include <FF.au3> #include <FF_AutoLogin.au3> If _FFConnect () Then $open = _FFWindowOpen("www.gmail.com") _FFloadwait($open) WinActivate($open) _FF_AutoLogin("user","password") EndIf Link to comment Share on other sites More sharing options...
Stilgar Posted November 13, 2009 Author Share Posted November 13, 2009 (edited) I'm getting a _FFDispatchEvent error when checking syntax. Here's my code and a screenshot...am I doing something wrong? #include <FF.au3> #include <FF_AutoLogin.au3> If _FFConnect () Then $open = _FFWindowOpen("www.gmail.com") _FFloadwait($open) WinActivate($open) _FF_AutoLogin("user","password") EndIf Yes, like I said one post before: It's updated for FF.au3 V0.6: http://thorsten-willert.de/Themen/FFau3/Testversion/FF_06.au3 And some corrections in your script: #include <FF.au3> #include <FF_AutoLogin.au3> If _FFConnect () Then _FFWindowOpen("www.gmail.com") ; activates the window per default / loadwait is build in now _FF_AutoLogin("user","password") EndIf Edited November 13, 2009 by Stilgar jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
lbw87 Posted November 13, 2009 Share Posted November 13, 2009 Still doesn't work.With FF.au3 version "0.6.0.0b-5" and _FF_AutoLogin.au3 version 4.0 and pasting your code from above I get 2 errors now Link to comment Share on other sites More sharing options...
Stilgar Posted November 13, 2009 Author Share Posted November 13, 2009 OK sorry I've uploaded a wrong version of the _FF_AutoLogin. V4.1 should work. jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
lbw87 Posted November 13, 2009 Share Posted November 13, 2009 where's 4.1? I can only find 4.0 Link to comment Share on other sites More sharing options...
Stilgar Posted November 13, 2009 Author Share Posted November 13, 2009 where's 4.1? I can only find 4.0Have you reloaded it? (cache)http://www.thorsten-willert.de/Themen/FFau3/Beispiele/FF_AutoLogin.au3 nirmalsalem 1 jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
lbw87 Posted November 13, 2009 Share Posted November 13, 2009 New errors with 4.1 ...still not working. Link to comment Share on other sites More sharing options...
Stilgar Posted November 14, 2009 Author Share Posted November 14, 2009 (edited) New errors with 4.1 ...still not working.Hmm - here it works (FF 3.5.5 / FF.au3 V0.6 / _FF_AutoLogin V4.1)Can you show me a copy (text) of the console-output, please? This picture is not good to read. Edited November 14, 2009 by Stilgar jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
lbw87 Posted November 14, 2009 Share Posted November 14, 2009 Hmm - here it works (FF 3.5.5 / FF.au3 V0.6 / _FF_AutoLogin V4.1) Can you show me a copy (text) of the console-output, please? This picture is not good to read. _FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3 _FFConnect: AutoIt: 3.2.12.1 _FFConnect: FF.au3: 0.6.0.0b-5 _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4242 _FFConnect: Delay: 2ms _FFConnect: Socket: 1716 __FFSend: try{window.content.top.document.browserDOMWindow}catch(e){'_FFCmd_Err';}; __FFRecv: __FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';}; __FFRecv: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729) _FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729) __FFSendJavascripts: Sending functions to FireFox .__FFWaitForRepl ==> MozRepl Exception: !!! [Exception... "Component is not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" ......... done _FFWindowOpen: http://www.gmail.com _FFLoadWait: . loaded in 151ms _FFWindowGetHandle: _FFWindowGetHandle ==> General Error __FFSendJavascripts: Sending functions to FireFox .......... done __FFSend: try{window.content.top.document.forms.length}catch(e){'_FFCmd_Err';}; __FFRecv: 0 __FFSend: FFau3.xpath=null;try{FFau3.xpath=window.content.top.document.evaluate("count(//form[1]//input[@type='password'])",window.content.top.document,null,XPathResult.NUMBER_TYPE,null).numberValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: 0 >Exit code: 0 Time: 3.276 Link to comment Share on other sites More sharing options...
Stilgar Posted November 14, 2009 Author Share Posted November 14, 2009 _FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3 _FFConnect: AutoIt: 3.2.12.1 _FFConnect: FF.au3: 0.6.0.0b-5 _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4242 _FFConnect: Delay: 2ms _FFConnect: Socket: 1716 __FFSend: try{window.content.top.document.browserDOMWindow}catch(e){'_FFCmd_Err';}; __FFRecv: __FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';}; __FFRecv: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729) _FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729) __FFSendJavascripts: Sending functions to FireFox .__FFWaitForRepl ==> MozRepl Exception: !!! [Exception... "Component is not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" ......... done _FFWindowOpen: http://www.gmail.com _FFLoadWait: . loaded in 151ms _FFWindowGetHandle: _FFWindowGetHandle ==> General Error __FFSendJavascripts: Sending functions to FireFox .......... done __FFSend: try{window.content.top.document.forms.length}catch(e){'_FFCmd_Err';}; __FFRecv: 0 __FFSend: FFau3.xpath=null;try{FFau3.xpath=window.content.top.document.evaluate("count(//form[1]//input[@type='password'])",window.content.top.document,null,XPathResult.NUMBER_TYPE,null).numberValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: 0 >Exit code: 0 Time: 3.276 Seems to be a problem with _FFWindowOpen. Habe you tried something like this with an open FireFox, too: #include <FF_AutoLogin.au3> If _FFConnect () Then _FF_AutoLogin("user","password", "www.gmail.com") EndIf jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
lbw87 Posted November 15, 2009 Share Posted November 15, 2009 (edited) nope...doesn't work. Below are the errors Both sets of code seem to open the Gmail webpage but then just sits there and doesn't login.. Autologin logs into gmail for you with both sets of code that you said to use? _FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3 _FFConnect: AutoIt: 3.2.12.1 _FFConnect: FF.au3: 0.6.0.0b-5 _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4242 _FFConnect: Delay: 2ms _FFConnect: Socket: 1716 __FFSend: try{window.content.top.document.browserDOMWindow}catch(e){'_FFCmd_Err';}; __FFRecv: __FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';}; __FFRecv: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729) _FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729) __FFSendJavascripts: Sending functions to FireFox .......... done _FFOpenURL: http://www.gmail.com __FFSend: try{window.content.top.document.location.href='http://www.gmail.com';}catch(e){'_FFCmd_Err';}; __FFRecv: http://www.gmail.com _FFLoadWait: .. loaded in 297ms __FFSend: try{window.content.top.document.forms.length}catch(e){'_FFCmd_Err';}; __FFRecv: 2 __FFSend: FFau3.xpath=null;try{FFau3.xpath=window.content.top.document.evaluate("count(//form[1]//input[@type='password'])",window.content.top.document,null,XPathResult.NUMBER_TYPE,null).numberValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: 1 __FFSend: FFau3.xpath=null;try{with(FFau3){this.obj=window.content.top.document.evaluate("//form[1]//input",window.content.top.document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);this.tmp=this.obj.snapshotLength;for(var i=0;i<this.obj.snapshotLength;i++){this.tmp+="FF996"+this.obj.snapshotItem(i).type;};this.tmp;}}catch(e){'_FFXPath_Error: ' +e;}; __FFRecv: 15FF996hiddenFF996hiddenFF996hiddenFF996hiddenFF996hiddenFF996hiddenFF996hiddenFF996hiddenFF996hiddenFF996textFF996passwordFF996checkboxFF996hiddenFF996submitFF996hidden __FFSend: FFau3.xpath=null;try{with(FFau3){this.obj=window.content.top.document.evaluate("//form[1]//input",window.content.top.document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);this.tmp=this.obj.snapshotLength;for(var i=0;i<this.obj.snapshotLength;i++){this.tmp+="FF839"+this.obj.snapshotItem(i).id;};this.tmp;}}catch(e){'_FFXPath_Error: ' +e;}; __FFRecv: 15FF839FF839FF839continueFF839serviceFF839rmFF839ltmplFF839ltmplFF839sccFF839FF839EmailFF839PasswdFF839PersistentCookieFF839FF839FF839asts __FFSend: FFau3.xpath=null;try{with(FFau3){this.obj=window.content.top.document.evaluate("//form[1]//input",window.content.top.document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);this.tmp=this.obj.snapshotLength;for(var i=0;i<this.obj.snapshotLength;i++){this.tmp+="FF552"+this.obj.snapshotItem(i).name;};this.tmp;}}catch(e){'_FFXPath_Error: ' +e;}; __FFRecv: 15FF552ltmplFF552ltmplcacheFF552continueFF552serviceFF552rmFF552ltmplFF552ltmplFF552sccFF552GALXFF552EmailFF552PasswdFF552PersistentCookieFF552rmShownFF552signInFF552asts __FFSend: try{FFau3.simulateEvent(,'KeyboardEvent','keypress',13);}catch(e){'_FFCmd_Err';}; __FFSend: ; __FFWaitForRepl ==> Error return value: MozRepl ....> __FFRecv: _FFLoadWait: .. loaded in 297ms >Exit code: 0 Time: 3.066 Edited November 15, 2009 by lbw87 Link to comment Share on other sites More sharing options...
Stilgar Posted November 15, 2009 Author Share Posted November 15, 2009 (edited) nope...doesn't work. Below are the errorsBoth sets of code seem to open the Gmail webpage but then just sits there and doesn't login..Autologin logs into gmail for you with both sets of code that you said to use?_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3_FFConnect: AutoIt: 3.2.12.1_FFConnect: FF.au3: 0.6.0.0b-5_FFConnect: IP: 127.0.0.1_FFConnect: Port: 4242_FFConnect: Delay: 2ms_FFConnect: Socket: 1716__FFSend: try{window.content.top.document.browserDOMWindow}catch(e){'_FFCmd_Err';};__FFRecv: __FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';};__FFRecv: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729)...Yes, my last example works for me. Have you tried it with current version (V3.5.5) of FireFox, too? Edited November 15, 2009 by Stilgar jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
lbw87 Posted November 16, 2009 Share Posted November 16, 2009 (edited) yes, just upgraded to 3.5.5 and still sits on the gmail.com webpage without ever logging in(with the correct credentials of course)... _FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3 _FFConnect: AutoIt: 3.2.12.1 _FFConnect: FF.au3: 0.6.0.0b-5 _FFConnect: IP: 127.0.0.1 _FFConnect: Port: 4242 _FFConnect: Delay: 2ms _FFConnect: Socket: 1692 __FFSend: try{window.content.top.document.browserDOMWindow}catch(e){'_FFCmd_Err';}; __FFRecv: __FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';}; __FFRecv: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729) _FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729) __FFSendJavascripts: Sending functions to FireFox .......... done _FFOpenURL: http://www.gmail.com __FFSend: try{window.content.top.document.location.href='http://www.gmail.com';}catch(e){'_FFCmd_Err';}; __FFRecv: http://www.gmail.com _FFLoadWait: ... loaded in 709ms __FFSend: try{window.content.top.document.forms.length}catch(e){'_FFCmd_Err';}; __FFRecv: 2 __FFSend: FFau3.xpath=null;try{FFau3.xpath=window.content.top.document.evaluate("count(//form[1]//input[@type='password'])",window.content.top.document,null,XPathResult.NUMBER_TYPE,null).numberValue;}catch(e){'_FFXPath_Error: '+e;}; __FFRecv: 1 __FFSend: FFau3.xpath=null;try{with(FFau3){this.obj=window.content.top.document.evaluate("//form[1]//input",window.content.top.document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);this.tmp=this.obj.snapshotLength;for(var i=0;i<this.obj.snapshotLength;i++){this.tmp+="FF268"+this.obj.snapshotItem(i).type;};this.tmp;}}catch(e){'_FFXPath_Error: ' +e;}; __FFRecv: 15FF268hiddenFF268hiddenFF268hiddenFF268hiddenFF268hiddenFF268hiddenFF268hiddenFF268hiddenFF268hiddenFF268textFF268passwordFF268checkboxFF268hiddenFF268submitFF268hidden __FFSend: FFau3.xpath=null;try{with(FFau3){this.obj=window.content.top.document.evaluate("//form[1]//input",window.content.top.document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);this.tmp=this.obj.snapshotLength;for(var i=0;i<this.obj.snapshotLength;i++){this.tmp+="FF221"+this.obj.snapshotItem(i).id;};this.tmp;}}catch(e){'_FFXPath_Error: ' +e;}; __FFRecv: 15FF221FF221FF221continueFF221serviceFF221rmFF221ltmplFF221ltmplFF221sccFF221FF221EmailFF221PasswdFF221PersistentCookieFF221FF221FF221asts __FFSend: FFau3.xpath=null;try{with(FFau3){this.obj=window.content.top.document.evaluate("//form[1]//input",window.content.top.document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);this.tmp=this.obj.snapshotLength;for(var i=0;i<this.obj.snapshotLength;i++){this.tmp+="FF765"+this.obj.snapshotItem(i).name;};this.tmp;}}catch(e){'_FFXPath_Error: ' +e;}; __FFRecv: 15FF765ltmplFF765ltmplcacheFF765continueFF765serviceFF765rmFF765ltmplFF765ltmplFF765sccFF765GALXFF765EmailFF765PasswdFF765PersistentCookieFF765rmShownFF765signInFF765asts __FFSend: try{FFau3.simulateEvent(,'KeyboardEvent','keypress',13);}catch(e){'_FFCmd_Err';}; __FFSend: ; __FFWaitForRepl ==> Error return value: MozRepl ....> __FFRecv: _FFLoadWait: .. loaded in 293ms Edited November 16, 2009 by lbw87 Link to comment Share on other sites More sharing options...
Stilgar Posted November 27, 2009 Author Share Posted November 27, 2009 yes, just upgraded to 3.5.5 and still sits on the gmail.com webpage without ever logging in(with the correct credentials of course)..._FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3_FFConnect: AutoIt: 3.2.12.1....Have you tried it with the current AutoIt-version (>V3.3.0.0)? jEdit4AutoIt PlanMaker_UDF Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now