Sign in to follow this  
Followers 0
boomingranny

Automate Log Out of facebook

8 posts in this topic

Hi,

I am trying to make a script to automatically logout of facebook when i am away from my computer for a few minutes, or when i hit a hotkey.

I am using IE, and whatever i do i can't get it to logout.

i have tried simply browsing to the http://www.facebook.com/logout.php

i have tried automating submission of the form,

i have tried automating clicking the logout button

nothing seems to be working for me.

Has anyone else out there managed to script this?

Cheers,

Daniel

Share this post


Link to post
Share on other sites



Maybe have a look at _IEAction() to Click the Logout button?!

Note: I don't personally use the IE Functions.


_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

Maybe have a look at _IEAction() to Click the Logout button?!

Note: I don't personally use the IE Functions.

thanks for the help,

tried _ieaction($oelement,"focus") then _ieaction($oelement,"click")

still doesn't appear to click it

tried setting focus to it then sending ie an enter key, still doesn't click it...

Share this post


Link to post
Share on other sites

Assuming you are already logged into facebook, this will navigate there, sleep, then logout.

I've not long been using IE functions so its very basic.

#include <IE.au3>

$oIE = _IECreate("http://www.facebook.com/")
$oForm = _IEGetObjById($oIE,"logout_form")

Sleep(5000)
_IEFormSubmit($oForm)

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Assuming you are already logged into facebook, this will navigate there, sleep, then logout.

I've not long been using IE functions so its very basic.

#include <IE.au3>

$oIE = _IECreate("http://www.facebook.com/")
$oForm = _IEGetObjById($oIE,"logout_form")

Sleep(5000)
_IEFormSubmit($oForm)

thanks John,

i had been doing that, but it has helped because i have found that it does (half) log you out of facebook.

if you don't run the above code then you close and reopen IE then you are still logged in

if you DO run the above code then you close and reopen IE then you are logged off

if you DO run the above code BUT you DON'T close IE you are still logged in!

so i am using the above code then forcing all ie processes to terminate, and that is working for my needs. thanks.

Share this post


Link to post
Share on other sites

Hi Guys Beside I have a problem with posting information on the share textarea. I haven't been able to find the form name corresponding to the textarea name which is "xhpc_message_text".can you please give me an example how to do it using Autoit ?

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Here is my code. My problem is that i cannot write in the status textarea. Help me please

#include <IE.au3>

_IEErrorHandlerRegister()

$user = "email@hotmail.com" ;<<< Change username

$pass = "password" ;<<< Change password

$url = "http://www.facebook.com" ;<<< Change webpage link

$oIE = _IECreate ($url)

$size = _IEPropertyGet( $oIE, "hwnd")

WinSetState( $size, "", @SW_MAXIMIZE)

_IELoadWait ($oIE)

$uForm = _IEFormGetObjByName ($oIE, "login_form") ;<<< Change to form html name on webpage

$uText = _IEFormElementGetObjByName ($uForm, "email") ;<<< Change to input name of username field box within form on webpage

_IEFormElementSetValue ($uText,$user)

$pText = _IEFormElementGetObjByName ($uForm, "pass") ;<<<Change to input name of password field box within form on webpage

_IEFormElementSetValue ($pText,$pass)

_IEFormSubmit ($uForm)

_IELoadWait ($oIE)

$form3 = _IEFormGetObjByName ($oIE, "u950521_79")

$mind = _IEFormElementGetObjByName ($form3, "xhpc_message_text")

_IEFormElementSetValue ($mind, "test")

Edited by pipo223

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  
Followers 0