Jump to content
mlukac89

Facebook messenger

Recommended Posts

mlukac89

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

#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 by mlukac89

Share this post


Link to post
Share on other sites
FireFox

down  :gathering:


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
FireFox

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/?next

For the other questions, it shouldn't be hard. I will take a look at it.

Br, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
FireFox

hm... you better use the fb API.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
mlukac89
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

Share this post


Link to post
Share on other sites
FireFox

Use StringLeft function to check only the beginning of the URL.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
mlukac89

Ok, and how i check if im logged or not ?

Share this post


Link to post
Share on other sites
FireFox

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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
mlukac89

Ah i forgot i can read text and all from page :D but thx

Share this post


Link to post
Share on other sites
DynamicRookie
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

#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 :D

 

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 by DynamicRookie

Share this post


Link to post
Share on other sites
JLogan3o13

@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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×