Jump to content
Sign in to follow this  

Facebook login / chat

Recommended Posts

Hi, im trying to make a small facebook messenger, but normally that i have problem since im here :)

How to get all friend and chat with them ? over TCP or UDP ?

And now window is not hidden but in future will be and process too.

Im not so good in explaining things but here is code

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIListBox.au3>
#include <IE.au3>

Global $window = _IECreate('https://www.facebook.com/', 0, 0, 1), $Form1, $login, $email, $password, $stayLogged

Local $oWbn = _IEGetObjById($window, "pagelet_welcome_box")

If IsObj($oWbn) = 0 Then
;~  MsgBox(0, '', 'not logged')

    $Form1 = GUICreate("Facebook messenger", 359, 210, 338, 218)
    GUICtrlCreateGroup("", 10, 8, 337, 137)
    GUICtrlSetFont(-1, 10, 800, 0, "Calibri")
    GUICtrlCreateLabel("Email :", 64, 36, 40, 19)
    $email = GUICtrlCreateInput("", 107, 32, 217, 23)
    GUICtrlCreateLabel("Password :", 41, 73, 63, 19)
    $password = GUICtrlCreateInput("", 107, 70, 217, 23, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
    $stayLogged = GUICtrlCreateCheckbox("Stay logged", 107, 104, 97, 17)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $login = GUICtrlCreateButton("Login", 10, 156, 337, 41)
    GUICtrlSetFont(-1, 12, 800, 0, "Calibri")


    ; if already logged in show other form
;~  MsgBox(0, '', 'logged in')
    $Form2 = GUICreate("Facebook Chat", 448, 466, 299, 146)
    $friendlist = GUICtrlCreateList("", 16, 16, 417, 266)
    $chatwindow = GUICtrlCreateList("", 16, 296, 417, 97)
    $text = GUICtrlCreateInput("", 16, 392, 417, 21)
    $sendBtn = GUICtrlCreateButton("Send", 360, 424, 75, 25)
    $logout = GUICtrlCreateButton("Logout", 16, 424, 75, 25)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $login
        Case $sendBtn


; check login
Func _checkLogin()

    If IsObj($oWbn) = 0 Then ; if not logged in

        ; check if empty fields
        If GUICtrlRead($email) == '' Or GUICtrlRead($password) == '' Then
            MsgBox(64, 'Info', 'Please enter email and password')
                - opens hidden internet explorer window
                - opens facebook page
                - get ID's form, email, password, remember me, and submit button
                - set values from GUI
                - submit form
            $formID = _IEGetObjById($window, 'login_form')
            $emailID = _IEGetObjById($window, 'email')
            $passID = _IEGetObjById($window, 'pass')
            $rememberID = _IEGetObjById($window, 'persist_box')
            $loginBtnID = _IEGetObjById($window, 'u_0_v')

            _IEFormElementSetValue($emailID, GUICtrlRead($email)) ; set email
            _IEFormElementSetValue($passID, GuictrlRead($password)) ; set password

            ; check for stay logged checkbox
            If GUICtrlRead($stayLogged) = $GUI_CHECKED Then
                _IEFormElementCheckBoxSelect($formID, 'persistent', '', 1, 'byIndex')

            _IEFormSubmit($formID) ; submit form

        EndIf ;=> login form

    EndIf ;=> if not logged in

EndFunc ;=> check login

; send message
Func _sendMsg()
    GUICtrlSetData($chatwindow, GUICtrlRead($text))


Edited by akira2891

Share this post

Link to post
Share on other sites

Hey Akira2891,

Facebook have tools that can assist you in building your messenger client. The last time I looked into this, they were using a facebook chat API. However a quick search shows that they've depreciated the api, and removed XMPP permissions for the messenger.

At first glance it seems like they're forcing developers to link to their messenger app and integrate with it, as opposed to allowing developers to integrate with it directly. (Notice here).

I'm not trying to discourage you, But the only way I can think of doing this, is to do utilise the Graph API they currently have (Found here); That contains Get requests for retrieving friends lists/ Messages etc... It may actually even be able to handle POST responses for messages; I haven't looked to in depth.

I would suggest reading the documentation on facebook's developer site, head over to W3Schools and school yourself on GET vs POST HTTP requests, and look into HTTP GET/POST requests on the forums here for examples on how to use them within AutoIT, (Example)

what you're trying to achieve is no small task, And I honestly believe that using the API will, although initially be harder to comprehend and implement successfully, would be a much better approach than trying to hide the facebook website in the background, And trying to send messages through the messenger portion of the website.

If you are still considering using a hidden browser window as your approach to this, then i would suggest you use www.messenger.com as this is facebooks website version of it's Messenger app.

Hopefully my ramblings help you, And best of luck.


give a man an application, and he'll be frustrated for the day, Teach him how to program applications and he'll be frustrated for a lifetime.

Share this post

Link to post
Share on other sites

I saw they removed API for messenger that day when they shut off their tool, so it will be hard way to get this to work especialy because i didnt worked with facebook API's never.

I have a decent knowledge in php but i will try to make it without php, because for php i need hosting to upload a script with code.

But again i think it's a best way to hide browser in background.

Anyway thanks for your reply.




Share this post

Link to post
Share on other sites

Why are you re-inventing the wheel?

UDF List:

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By FengHuangWuShen
      So I was playing with INet and downloading files and made a simple video downloader, or it can even be used for any file really.
      Just follow the reference section in INet_Settings.ini , and then run the script.
      Main Script <snip>
      INet_Settings.ini  URL - The target URL of the video you're trying to grab Data - This is the starting string, and ending string reference to look for the download URL itself. Settings - Only setting here currently, is the delay in which to wait for the file to download ### Reference for Start and End points for various websites <snip>
      Credits to : https://www.autoitscript.com/forum/profile/31965-progandy/  for the URL Encode and Decode.
    • By AoRaToS
      I started working on this program in the summer of 2008 then I stopped cause I faced some problems I couldn't overcome back then. Now that I've practiced more and have become a better scripter/programmer I'm releasing the program to the public to get some opinions. I know it's not a new concept but it's the first program I started besides some small stuff I did just for practice! I won't post the source code yet because it's still under construction, although I'm sure I've posted early stages of the code with bugs in the past in some topic...
      What I wanted was a simple, small, serverless program that would work without installation cause I wanted it for where I work, so I ended up with this!
      I have attached some images of various versions, also visit the forum thread.
      The package includes s!mpL3 LAN Messenger and the full change log.
      Current version! [04/07/2019]
      Check the Change Log below!
      Read the license before using this software.
    • By AoRaToS
      s!mpL3 LAN Messenger as the name suggests is a messenger designed and developed to offer chat communication over Local Area Networks while being as simple to use as possible. This project started way back in 2008 with only basic functionality and is regularly updated with new features in order to make it more useful and user friendly. What I wanted was a simple, small, serverless program that would work without installation cause that was the ideal combination for my workplace back then, so I ended up with this!

      I have attached some images from various versions:
      Check the rest below! (from various versions)

      More than 10.000 downloads!

      s!mpL3 LAN Messenger version - [04/07/2019] - s!mpL3 LAN Messenger.zip
      1. Fixed an issue that would occur when blocking another user and they would re-appear in the TreeView.
      2. Updated File Transfers to make long file names shorter if they were too long to appear in the tray tip.
      3. Removed notifications when checking for updates at application startup if there is no update available.
      You can view/download the full change log here: ChangeLog.txt

      Tested and working on both 32bit and 64 bit editions of Windows XP, Windows Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10.

      Things you need to know before trying it:

      1. Start the program, select one or more connections from what's available and click Connect (If a firewall notice comes up, click 'Allow' or 'Add Exception')
      When someone else on your network does the same, they will appear in your Tree-view and you will appear in theirs, double click their name and chat!

      2. s!mpL3 LAN Messenger does not require a server to be running, it's standalone.

      3. On the first run an .ini file is created at @LocalAppDataDir\s!mpL3 LAN Messenger which stores the settings so that they are used every time you run the application. If you delete the .ini file it will be created again (with default settings at program startup or with your selected settings if you press Save from the Preferences window).

      4. All communication is encrypted using AES so it's quite secure against Network sniffers.

      5. You can send files and folders by dragging and dropping them in a conversation window. Folders are compressed before being sent. You can also drop multiple items to be sent.

      6. There is a "Hide" button located in the tray right click context menu that will hide all open windows. You can assign a Hotkey combination from Preferences. The default combination is Ctrl+H.

      7. s!mpL3 LAN Messenger uses port 60000 by default. You can change the port used by adding "Port=****" (without quotes, stars represent numbers) to the Config file described above. Communication is UDP.

      8. There is an Updater feature you can use to always have the latest available version, you only need an internet connection for that to work. You might need to clear your Internet Explorer Temporary Files in order for it to find an updated version.

      9. You can Hide + Lock s!mpL3 LAN Messenger so it'll require a password in order to "Appear". To enable this, go to the Security Preferences.

      10. Note that versions after are not compatible with previous versions due to the encryption used being changed. I recommend using the latest version, or at least use the same version over the LAN.

      Important Notice:

      I will not be releasing the source code, however, I might share some parts of code if requested...
      If you choose to de-compile this software, don't release the source code.

    • By Simpel
      I wanted to use _GetLogonTime() by guinness (https://www.autoitscript.com/forum/topic/19370-autoit-wrappers/?do=findComment&comment=942069).
      #include <Date.au3> #include <Array.au3> ConsoleWrite(_GetLogonTime() & @LF) Func _GetLogonTime($sUserName = @UserName, $sComputerName = @ComputerName) ; Idea by trancexx: http://www.autoitscript.com/forum/topic/113611-if-isadmin-not-detected-as-admin/ Local $aRet = DllCall("netapi32.dll", "long", "NetUserGetInfo", "wstr", $sComputerName, "wstr", $sUserName, "dword", 11, "ptr*", 0) _ArrayDisplay($aRet) If @error Or $aRet[0] Then Return SetError(1, 0, False) Local $sHours = DllStructGetData(DllStructCreate("ptr;ptr;ptr;ptr;dword;dword;dword;ptr;ptr;dword;dword;dword;dword;ptr;dword;ptr;dword;dword;byte;dword", $aRet[4]), 18) DllCall("netapi32.dll", "long", "NetApiBufferFree", "ptr", $aRet[4]) Return _DateAdd("h", "-" & $sHours, _NowCalc()) EndFunc ;==>_GetLogonTime It always returns false.
      I displayed $aRet:
      $aRet[4] shouldn't be 0x0000000000000000 right? Any help?
      Regards, Conrad
    • By Lourens
      I am looking for a way to automate login to a Internet Banking website (https://bank.tymedigital.co.za/) and all of the examples that I could found still do not solve my issue with this website.
      In order to Login, the user need to enter their Identity Number and Password the click the Login button.
      Inspecting the Elements in Chrome are as follow;
      Identity Number
      <input autocomplete="username" placeholder="Please enter your South African ID number" maxlength="13" type="tel" class="form-control" value=""> Password
      <input autocomplete="current-password" placeholder="Enter password" type="password" class="form-control" value=""> Button
      <button type="button" class="btn btn-yellow btn-block">Login</button> Any assistance or directing me to a solution will be appreciated.
      Thank you,
  • Create New...