mlukac89 Posted March 6, 2014 Posted March 6, 2014 (edited) Hi, I want to make Facebook messenger, is it possible with AutoIt ? I made this piece of code, it works fine, while login browser is not showing like i want. I check after login if its logged when i open facebook page in IE manual and its logged so all is good. Now im interested if i can make this : How can i check if email and password is valid ? How can i know if im logged ? How i can get list of friends ? How to send message to friend ? How to show GUI window when friend send you message ? I don't want to show IE in any way expandcollapse popup#include <IE.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $url = 'https://facebook.com' $GUI = GUICreate("Form 1", 256, 210, 342, 170) GUISetFont(10, 400, 0, "Tahoma") $email = GUICtrlCreateInput("", 85, 24, 150, 24) $pass = GUICtrlCreateInput("", 85, 56, 150, 24, $ES_PASSWORD) GUICtrlCreateLabel("Email", 14, 27, 35, 20) GUICtrlCreateLabel("Password", 14, 59, 59, 20) $keeplogged = GUICtrlCreateCheckbox("Keep me logged in", 85, 96, 121, 17) $login = GUICtrlCreateButton("Log in", 27, 144, 201, 41, BitOR($BS_DEFPUSHBUTTON,$BS_FLAT)) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $login ; open browser ; url ; 1 = Try to attach to an existing window, 0 = (Default) do not try to attach ; 1 = (Default) Browser Window is visible, 0 = Browser Window is hidden ; 1 = (Default) Wait for page load to complete before returning, 0 = Return immediately, not waiting for page to load ; 1 = (Default) bring window into focus, 0 = Do not bring window into focus $IE = _IECreate($url, 1, 0, 1, 1) Sleep(2000) ; wait 2 seconds untill IE loads ; get properties of fields $Form = _IEFormGetCollection($IE, 0) $Username = _IEFormElementGetObjByName($Form, 'email') ; id of email field $Password = _IEFormElementGetObjByName($Form, 'pass') ; id of password field $Checkbox = _IEFormElementGetObjByName($Form, 'persist_box') ; id of checkbox field ; set values _IEFormElementSetValue($Username, GUICtrlRead($email)) _IEFormElementSetValue($Password, GUICtrlRead($pass)) ; Keep logged in if chceckbox is selected If GUICtrlRead($keeplogged) == $GUI_CHECKED Then _IEFormElementCheckBoxSelect($Form, $Checkbox, "", 1, "byIndex") ; submit form _IEFormSubmit($Form) EndSwitch WEnd Edited March 6, 2014 by mlukac89
FireFox Posted March 7, 2014 Posted March 7, 2014 (edited) More seriously :How can i check if email and password is valid ?If it does not redirect to /login.php?login_attempt=1 after the form submit. How can i know if im logged ?If it does not redirect to the above link (though there are plenty of other ways to detect it).Except if some verification code is needed, in this case the link will be : /checkpoint/?nextFor the other questions, it shouldn't be hard. I will take a look at it.Br, FireFox. Edited March 7, 2014 by FireFox
mlukac89 Posted March 7, 2014 Author Posted March 7, 2014 If it does not redirect to /login.php?login_attempt=1 after the form submit. I tried this i use this as link too /login.php?login_attempt=1 and read data from it then check with ( If true Then ), it works if -fields are empty -if you enter invalid email -if you enter email and not password But if you got invalid password it redirect to some other link like this https://www.facebook.com/login/help.php?st=ipw&cuid=AYh1uXvT8CxRXEAOuz8uTgxBiSsuagKFJIzFqxxTJdEI3eF9bOtj2etEXznTD6jU3Ga5u5EGtIwDihw5O08pugAlAFjnbikX3B0W1sKo83U-Z9wQsksv33KGDM9dQ5v6Qw2eDTMTmHzRvCRMh8sqqlKWdncUCfbWydfHMZIHj2RStA and every time that is diferent because this CUID= is hash So still same question remains what if password is wrong and redirects you to other link like this above ? How can i know if im logged ? How i can get list of friends ? How to send message to friend ? How to show GUI window when friend send you message ? I found UDF for Facebook but dont works for me http://www.codebot.de/board77-autoit/board80-files-autoit/11793-facebook-udf/?s=7a10b47f77240505f70871817ef3d0fef752b269
FireFox Posted March 7, 2014 Posted March 7, 2014 Use StringLeft function to check only the beginning of the URL.
FireFox Posted March 7, 2014 Posted March 7, 2014 Think a little bit. One way would to detect if an element is present or not on the page like this one : Local $oWbn = _IEGetObjById($oIE, "fbxWelcomeBoxName") If IsObj($oWbn) = 0 Then ;not logged Else ;OK EndIf Br, FireFox.
mlukac89 Posted March 7, 2014 Author Posted March 7, 2014 Ah i forgot i can read text and all from page but thx
DynamicRookie Posted January 3, 2018 Posted January 3, 2018 (edited) On 6/3/2014 at 7:44 AM, mlukac89 said: Hi, I want to make Facebook messenger, is it possible with AutoIt ? I made this piece of code, it works fine, while login browser is not showing like i want. I check after login if its logged when i open facebook page in IE manual and its logged so all is good. Now im interested if i can make this : How can i check if email and password is valid ? How can i know if im logged ? How i can get list of friends ? How to send message to friend ? How to show GUI window when friend send you message ? I don't want to show IE in any way expandcollapse popup#include <IE.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $url = 'https://facebook.com' $GUI = GUICreate("Form 1", 256, 210, 342, 170) GUISetFont(10, 400, 0, "Tahoma") $email = GUICtrlCreateInput("", 85, 24, 150, 24) $pass = GUICtrlCreateInput("", 85, 56, 150, 24, $ES_PASSWORD) GUICtrlCreateLabel("Email", 14, 27, 35, 20) GUICtrlCreateLabel("Password", 14, 59, 59, 20) $keeplogged = GUICtrlCreateCheckbox("Keep me logged in", 85, 96, 121, 17) $login = GUICtrlCreateButton("Log in", 27, 144, 201, 41, BitOR($BS_DEFPUSHBUTTON,$BS_FLAT)) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $login ; open browser ; url ; 1 = Try to attach to an existing window, 0 = (Default) do not try to attach ; 1 = (Default) Browser Window is visible, 0 = Browser Window is hidden ; 1 = (Default) Wait for page load to complete before returning, 0 = Return immediately, not waiting for page to load ; 1 = (Default) bring window into focus, 0 = Do not bring window into focus $IE = _IECreate($url, 1, 0, 1, 1) Sleep(2000) ; wait 2 seconds untill IE loads ; get properties of fields $Form = _IEFormGetCollection($IE, 0) $Username = _IEFormElementGetObjByName($Form, 'email') ; id of email field $Password = _IEFormElementGetObjByName($Form, 'pass') ; id of password field $Checkbox = _IEFormElementGetObjByName($Form, 'persist_box') ; id of checkbox field ; set values _IEFormElementSetValue($Username, GUICtrlRead($email)) _IEFormElementSetValue($Password, GUICtrlRead($pass)) ; Keep logged in if chceckbox is selected If GUICtrlRead($keeplogged) == $GUI_CHECKED Then _IEFormElementCheckBoxSelect($Form, $Checkbox, "", 1, "byIndex") ; submit form _IEFormSubmit($Form) EndSwitch WEnd Answers: How to know if the user is logged on: Make a AutoIt script that saves the variables $_IsUserLogged and #include it when it boots up, like Batch code Your other questions are not possible in AutoIt, you need access to Facebook servers to accomplish those functions, try using Facebook API Leaving the fact is illegal modifying the Facebook Messenger code, why would you make a Messenger in AutoIt. Edited January 3, 2018 by DynamicRookie
Moderators JLogan3o13 Posted January 3, 2018 Moderators Posted January 3, 2018 @DynamicRookie did you happen to notice that this post is almost 4 years old? Or that the OP has not been active in just as long? Please do not resurrect old threads. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Recommended Posts