Facebook login / chat

6 posts in this topic

#1 ·  Posted (edited)

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?

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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: 04/09/2015

Share this post

Link to post
Share on other sites

Why u ask that ? Is there any working facebook messenger ? For windows

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

  • Similar Content

    • Simpel
      By Simpel
      after I recognized that some of my scripts fail if they are at windows startup I researched for a solution. Problem could be fixed if I wait about 120 seconds after login. So how to measure this?
      #include-once #include <AD.au3> #include <Date.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SecondsAfterLogin ; Description ...: Returns how many seconds are gone since last login ; Syntax ........: _SecondsAfterLogin() ; Parameters ....: None ; Return values .: Success - Integer of seconds ; Failure - 0, sets @error to 1 ; Author ........: Conrad Zelck ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _SecondsAfterLogin() Local $sDate Local $iSec $sDate = __GetLogonTime() ; UTC If @error Then $sDate = __GetLogonTime_AD() ; local time If @error Then Return SetError(1, 0, 0) Else $sDate = __LocalTime($sDate) ; UTC to local time EndIf $iSec = __TimeDifference($sDate) Return $iSec EndFunc #region - INTERNAL_USE_ONLY 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) If @error Or $aRet[0] Then Return SetError(1, 0, 0) Local $sSeconds = DllStructGetData(DllStructCreate("ptr;ptr;ptr;ptr;dword;dword;dword;ptr;ptr;dword;dword;dword;dword;ptr;dword;ptr;dword;dword;byte;dword", $aRet[4]), 10) DllCall("netapi32.dll", "long", "NetApiBufferFree", "ptr", $aRet[4]) Local $sLastLogon = _DateAdd('s', Number($sSeconds), "1970/01/01 00:00:00") Return $sLastLogon EndFunc Func __GetLogonTime_AD() Local $iSuccess = _AD_Open() If $iSuccess = 1 Then Local $sDate = _AD_GetLastLoginDate() $sDate = __NumberDate_StringDate($sDate) _AD_Close() Return $sDate Else Return SetError(1, 0, 0) EndIf EndFunc Func __NumberDate_StringDate($sDate) Local $y, $m, $d, $h, $min, $s $y = StringMid($sDate,1, 4) $m = StringMid($sDate,5, 2) $d = StringMid($sDate,7, 2) $h = StringMid($sDate,9, 2) $min = StringMid($sDate,11, 2) $s = StringMid($sDate,13, 2) $sDate = $y & "/" & $m & "/" & $d & " " & $h & ":" & $min & ":" & $s Return $sDate EndFunc Func __LocalTime($sDate) Local $aTimeZone = _Date_Time_GetTimeZoneInformation() If $aTimeZone[0] <> 2 Then $iTimeZoneOffset = ($aTimeZone[1]) * -1 Else $iTimeZoneOffset = ($aTimeZone[1] + $aTimeZone[7]) * -1 EndIf $iTimeZoneOffset /= 60 ; in hours Local $sHour = StringMid($sDate, 12, 2) $sHour += $iTimeZoneOffset $sDate = StringLeft($sDate, 11) & $sHour & StringRight($sDate, 6) Return $sDate EndFunc Func __TimeDifference($sDate) Local $sNow = _NowCalc() Local $sDiff = _DateDiff("s", $sDate, $sNow) Local $iDiff = Number($sDiff) Return $iDiff EndFunc #endregion - INTERNAL_USE_ONLY I had to look what kind of login it is. Some of my computers are logging in with active directory and other not.
      Here is an example:
      #include <SecondsAfterLogin.au3> Local $iSec = _SecondsAfterLogin() MsgBox(0, '', "Time since last login: " & _HHMMSS($iSec, "s")) Exit Func _HHMMSS($iTime, $sType = "ms") If $sType = "s" Then Local $sHHMMSS = StringFormat("%.2d:%.2d:%.2d", (Floor($iTime / 3600)), (Floor(Mod($iTime,3600) / 60)), (Mod(Mod($iTime,3600),60))) Else Local $sHHMMSS = StringFormat("%.2d:%.2d:%.2d", (Floor($iTime / 3600000)), (Floor(Mod($iTime,3600000) / 60000)), (Mod(Mod($iTime,3600000),60000) / 1000)) EndIf Return $sHHMMSS EndFunc I hope someone find it useful.
      Regards, Conrad
      P.S. Review is welcome.
    • rcmaehl
      By rcmaehl
      A UDF to connect to IRC using TCP Functions, as well as perform actions once connected.
      WANTED: Technical Writer able to create / maintain a helpfile (.chm) using the Autoit helpfile layout for an negotiated rate.

      Originally created by Chip.
      UDF Headers updated compared to old script.
      Error and Parameter Handling updated compared to old script.
      If you need to bypass the RFC compliance of this UDF, use _IRCRaw.
      The majority of the old functions have been modified. It will break most, if not all, scripts using the old UDF.
      These commands should work on every server following either RFC 1459 (legacy) or RFC 2812 (preferred).
      Potential Uses:
      IRC Chat Clients
      Chatroom Integration for software
      IRC Bots for Channel / Server Administration
      IRC Bots for Games such as Hangman, Mafia, and WereWolf
      Remote Administration without having to setup your own AutoIt server

      Extra Functions:
      _IRCReplyTo (IRCExtras.au3)
      _IRCStripSpecial (IRCExtras.au3)
      Additional Links:
      Chips' Old UDF Topic:

      While these downloads are more stable than the ones above, I do not have time to thoroughly test all functions and variable entries. If something doesn't work as expected or gives you an error please check @error and @extended variables then create a reply to this topic.

      09/06/2016: IRC.au3 Fixed : Updated Headers to UDF-spec (- instead of =) _IRCGetMsg Fixed : Incorrect Return Value On Error _IRCStripSpecial Added : Better documentation of Flags _IRCMultiSendMsg Added : Better documentation of Flags _IRCMultiSendMsg Fixed : Max Message Size based on https://forums.unrealircd.org/viewtopic.php?t=6811 Updated all files to consider themselves a standalone install by default All Functions that didn't Return anything now return Number of bytes sent Slight Performance Improvements by using Parameter Gating instead of Single Input Single Output 07/21/2016: Example.au3 Fixed : Includes Example.au3 Renamed: IRC_Example.au3 IRC.au3 Changed: Minor Performance Improvements 04/18/2016: IRCConstants.au3 Updated: A Ton of New Constants added IRCMultiSendMsg Added : Color Example Increased TCP Timeout in all Examples 04/13/2016: CUI.au3 Updated: Errors now output to Error Stream in Console (C/G)UI.au3 Fixed : Userlists (FOR REAL THIS TIME) by being sure to get the current channel Removed: Duplicate Constants File Include Removed: Local Declaration inside of While loop for Performance Updated: TCPTimeout Increased Updated: $sTemp renamed $sStrip for Readibility Example.au3 Updated: TCPTimeout Increased GUI_Client.au3 Renamed: GUI.au3 _IRCStripSpecial Added : Parameter Checking Updated: Documentation _IRCMultiSendMsg Added : Additional flags for Message Type (POSSIBLY SCRIPT BREAKING if using $_bTrim!) Updated: Example to show new flags Updated: Increase Max Message Size from 368 To 436 04/09/2016: IRC.au3 Updated: All Documentation Added : Now has a Constaznts file _IRCConnnect Fixed : Now PROPERLY returns any errors _IRCGetMsg Removed: $_iChars parameter since it gets one packet at a time and parsing is easier _IRCReplyTo Fixed : Now properly returns username _IRCStripSpecial Added : Now uses Constants File All files are now in a single ZIP Includes 2 basic IRC "clients", a CUI, and a GUI 07/15/2015: Example.au3 Added : Improved Debugging   Updated: All Space Indents to Tab Idents   IRC.au3 Removed: Exception skipping @error = -1 in IRCGetMsg() as fixed it 07/15/2015: Example.au3 Added : Ping Timeout Fixed : Userlist clipping of last user IRC.au3 Fixed : IRCGetMsg() Hang 07/08/2015: Example.au3 Fixed : User Lists   Fixed : Nickname now switches to backup nickname if first choice is already in use IRC.au3 Added : UDF Index Added : #include-once Updated: All Functions updated to Single Entry, Single Exit Updated: Now passes Au3Check on -q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 01/15/2015: Example.au3 Fixed : Ampersand channels causing a crash 12/20/2014: Example.au3 Fixed : Nicks not updating on all channel lists when a user changed their nick Fixed : Nicks not deleting on all channel lists when a user quits the network 12/19/2014: Example.au3 Added : User lists Added : Channel lists Added : Bot keeps track of own nick Added : Secondary nick in case first nick choice is in use. Added : Extremely Minor performance improvements _IRCConnect Added : Improved parameter checking _IRCGetMsg Updated: Now only retrieves one packet by default (MAY be script breaking) 10/14/2014: Example.au3 Added : Shutdown TCP on exit Fixed : $Recipient now gets the actual Recipient instead of the 3rd message Added : Now exits when told to quit. IRC.au3 Added : Improved Error Reporting (Includes @extended on error) _IRCDisconnect Added : Close Socket on Disconnect _IRCStripSpecial Added : Improved Color Stripping 09/28/2014: _IRCConnect Fixed : Checking if Mode was blank. _IRCGetMsg Fixed : Spamming of 0 and incorrectly thinking there was an error. 09/28/2014: IRC.au3 Fixed : All functions now return when errors are encountered instead of continuing _IRCConnect Added : Now returns an error if optional password failed to send _IRCGetMsg Added : Now returns an error if it failed to receive a custom amount of data _IRCServerVersion Fixed : Capitalized "Version" 09/26/2014: Example.au3 Fixed : Pings not ending with @CRLF IRCExtras.au3 Added : _IRCStripSpecial(), Cleans special characters sometimes seen in IRC 09/24/2014: Example.au3 Added : Checking for PrivMsg Fixed : Infinite loop if you removed _IRCDisconnect Updated: Bot now disconnects when receiving "!quit" instead of automatically Discontinuted BETA UDF project. 04/20/2014: IRCExtras.au3 Added : Additional IRC Functions _IRChangeNick Renamed: _IRCSelfSetNick (SCRIPT BREAKING! Fix: Replace _IRCChangeNick with _IRCSelfSetNick) _IRCGetMsg Fixed : Now no longer Splits Packets if Default option is used _IRCChannelInvite Added : Invites a User to a Channel _IRCChannelKick Added : Kick a User from a channel _IRCJoinChannel Renamed: _IRCChannelJoin (SCRIPT BREAKING! Fix: Replace _IRCJoinChannel with _IRCChannelJoin) _IRCMode Renamed: _IRCMultiMode (SCRIPT BREAKING! Fix: Replace _IRCMode with _IRCMultiMode) _IRCOper Renamed: _IRCSelfOper (SCRIPT BREAKING! Fix: Replace _IRCOper with _IRCSelfOper) _IRCPartChannel Renamed: _IRCChannelPart (SCRIPT BREAKING! Fix: Replace _IRCPartChannel with _IRCChannelPart) _IRCPing Renamed: _IRCServerPing (SCRIPT BREAKING! Fix: Replace _IRCPing with _IRCServerPing) _IRCPong Renamed: _IRCServerPong (SCRIPT BREAKING! Fix: Replace _IRCPong with _IRCServerPong) _IRCSelfSetStatus Added : Sets you AFK and un-AFK _IRCSendMessage Renamed: Renamed _IRCMultiSendMsg. (SCRIPT BREAKING Fix: Replace IRCSendMessage with IRCMultiSendMsg) _IRCSendMessageRaw Renamed: Renamed _IRCRaw (SCRIPT BREAKING! Fix: Replace _IRCSendMessageRaw with _IRCRaw) _IRCServerTime Added : Get time from a Server _IRCServerVersion Added : Get Software Version from a Server _IRCTopic Renamed: _IRCChannelTopic (SCRIPT BREAKING! Fix: Replace _IRCTopic with _IRCChannelTopic) Improved Parameter detection in all Functions Renamed Functions to show who/what they effect, MASSIVE Script Breaking. Sorry! :/ 04/06/2014: _IRCGetMsg Added : Use to get IRC Messages. _IRCSetTopic Changed: Now named _IRCTopic (SCRIPT BREAKING! Fix: Replace _IRCSetTopic with _IRCTopic) Changed: Can now be used to query topic and does so by default. Use "" to blank the topic All functions now thoroughly check their parameters Updated all functions to use @extended to some errors Fixed @error returning 0 by starting all errors at 1 instead of 0 03/20/2014: _IRCChangeMode Changed: Now named _IRCMode (SCRIPT BREAKING! Fix: Replace _IRCChangeMode with _IRCMode) Changed: $_sMode is now OPTIONAL. Allowing the command to be used to Query current mode as well _IRCConnect Fixed : Missing Colon Before $_sRealName. It should now allow Real Names with spaces _IRCDisconnect Fixed : Issue with Blank Messages. Should now properly blank to Default _IRCPing Changed: $_Server is now REQUIRED. (SCRIPT BREAKING! Fix: Specify a server as Parameter 2) _IRCSendMessage Added : $_bTrim, Trims message if too long instead of breaking up the message, Default is true _IRCSetTopic Added : Command for setting a Channel Topic Updated Most Functions to include better error checking Updated Most Channel Related Functions to check for valid channels 03/16/2014: _IRCChangeMode Added : Optional parameters for channel modes Changed: Parameter ordering Target is now before Mode (SCRIPT BREAKING! Fix: Swap Parameters 2 and 3) _IRCConnect Changed: No longer exits the script on error, instead returns TCPConnect Error Code _IRCJoinChannel Added : Now Supports Channel Passwords _IRCOper Added : Command for IRC Server Operator Login Updated All Functions to have UDF standard error codes 02/24/2014: _IRCSendMessage Changed: Split Into _IRCSendMessage and _IRCSendMessageRaw (SCRIPT BREAKING! No Simple Fix Available) 02/23/2014: Made variables comply to UDF Standards http://www.autoitscript.com/autoit3/udfs/UDF_Standards.htm Removed MsgBoxes left over from old UDF Updated / Uploaded IRC.au3 Known and Reported Bugs:
      Message output only displays ANSI characters in CUI. (Can't Fix) Freenode requires registration for part messages thus the part message in example doesn't show up (Can't fix) Messages (e.g. PRIVMSG) are not forwarded?, when it contains umlauts/german mutations and when the message only contains a dot '.' (Unconfirmed) Warnings:
      Do NOT send a lot of messages at once. MOST networks will disconnect you. SOME networks will permanently ban you. A MINORITY will harshly retailiate. Do NOT use the Sleep() function in your scripts. It prevents you from receiving any new data, can disconnect your from the network, and have other undesired consequences. Use the TimerInit() and TimerDiff() functions and possibly a message queue. To Do:
      Possibly add in SSL functionality Create More Functions for IRC commands An entire IRC daemon written in AutoIt Possibly Include Kips TCP UDF for ASync Port Listening in Example Create Additional UDFs for extras such as CTCP, DCC, and Error Lookup Experiment with having functions check for the reply and see if reliable. Upcoming Changes:
      To Be Decided
    • Simpel
      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
    • Cormin
      By Cormin
      My script currently reads a text file line by line. I want it to look for this the chat message below and skip the session messages. 
      There are some garbage lines that I want it to skip over. So if a line doesnt match that format then skip it. I tried experimenting with StringRegExp but I think I'm using it wrong. Heres my code
      If StringRegExp($read, '\W\d\d\w\d\d\D.\W') = Not @error Then I was hoping that this would be able to see the open bracket, 2 digits, a colon, 2 digits,  close bracket, a space and a <. But it doesn't seem to be working.
      Eventually I want to be able to extract the username and chat message into separate strings but I haven't got that far yet.
    • Jemboy
      By Jemboy
      I am trying to log into live.com using AutoIt.
      There are several examples, but none of them work with the current webpage.
      This is my code (because the username and password are not valid ;-) , I comment the "button click" out.):
      #include <IE.au3> Local $oIE = _IECreate("live.com") _IELoadWait ($oIE) _IELinkClickByText($oIE, "Sign in") $o_form = _IEFormGetObjByName ($oIE, "f1") $o_login = _IEFormElementGetObjByName ($o_form, "loginfmt") $o_password = _IEFormElementGetObjByName ($o_form, "passwd") $o_signin = _IEFormElementGetObjByName ($o_form, "idSIButton9") $username = "test@hotmail.com" $password = "testpassword" _IEAction ($o_login, "focus") _IEFormElementSetValue ($o_login, $username) _IEFormElementSetValue ($o_password, $password) ;_IEAction ($o_signin, "click") When I run the code I get the following:

      The value being set is garbeled with "PlaceholderText".
      Because of this, the username and password are invalid.
      Here screenhot of the placeholders text:

      When you start typing in one of the fields, the placeholder text is automatically deleted.
      When you set a value it stays.
      I found a workaround, to set focus on the element and send the username as an keyboard input to the field,
      but I would like a clean solution based on variables.
      So, does anyone now how to do this?