Jump to content

How to input textarea on Facebook to update status?


 Share

Recommended Posts

Hi, everyone.

I want to update status on Facebook

Here is my code

; Include IE and ScreenCapture
#include <ie.au3>
#include <ScreenCapture.au3>

; Login Facebook
$oIE = _IECreate ("http://www.facebook.com")
WinSetState("", "", @SW_MAXIMIZE)
$oForm = _IEFormGetObjByName ($oIE, "login_form")
$oEmail = _IEFormElementGetObjByName ($oForm, "email")
$oPass = _IEFormElementGetObjByName ($oForm, "pass")
$uname="xxxxxx@yahoo.com"
$pwd="xxxxxxxxxxxx"
_IEFormElementSetValue ($oEmail,$uname)
_IEFormElementSetValue ($oPass,$pwd)
$oButton=_IEGetObjById($oIE,"loginbutton")
_IEAction ($oButton, "click")
_IELoadWait($oIE,1000)

; Post Facebook Status
Local $oFrame = _IEFrameGetObjByName ($oIE, 'textarea')
Local $oForm = _IEFormGetObjByName ($oFrame, "u_0_13")
Local $oTextArea = _IEFormElementGetObjByName ($oForm, 'xhpc_message_text')
_IEFormElementSetValue ($oTextArea,'coba')

; Capture Screenshoot
_ScreenCapture_Capture(@ScriptDir & "\SS.jpg")

; Logout Facebook
_IELoadWait($oIE,1500)
MouseClick("primary", 1046, 71, 1, 0)
_IELoadWait($oIE,1500)
MouseClick("primary", 927, 508, 1, 0)

; Exit IE
_IELoadWait($oIE,1500)
_IEQuit($oIE)

It will login facebook, update status, capture screenshot, and logout facebook as well as internet explorer.

 

 

But, for update status, I cannot do that.

It's different from login facebook.

 

Can you help me?

Link to comment
Share on other sites

Hello. this work for me.

 

Local $colForms = _IEFormGetCollection($oIE) ; get all forms
For $oForm In $colForms ; loop over form collection

    ConsoleWrite("---- FORM " & $oForm.name & " ----" & $oForm.className & @CRLF)
    $oFormElements = _IEFormElementGetCollection($oForm) ; get all elements
    For $oFormElement In $oFormElements ; loop over element collection
        If StringLower($oFormElement.tagName) == 'textarea' Then ; it is a textarea
            If $oFormElement.name == "xhpc_message" Then _IEFormElementSetValue($oFormElement, "Hello World!!!", 0) ; set value of the field
        EndIf

    Next
Next

Saludos

Link to comment
Share on other sites

Hello. this work for me.

 

Local $colForms = _IEFormGetCollection($oIE) ; get all forms
For $oForm In $colForms ; loop over form collection

    ConsoleWrite("---- FORM " & $oForm.name & " ----" & $oForm.className & @CRLF)
    $oFormElements = _IEFormElementGetCollection($oForm) ; get all elements
    For $oFormElement In $oFormElements ; loop over element collection
        If StringLower($oFormElement.tagName) == 'textarea' Then ; it is a textarea
            If $oFormElement.name == "xhpc_message" Then _IEFormElementSetValue($oFormElement, "Hello World!!!", 0) ; set value of the field
        EndIf

    Next
Next

Saludos

Oh pity me, my knowledge is still below average.

I will try that.

What was the reason you felt the need to create a new account for this question?

Jos

What do you mean? I am a new in this forum.

And this is my account. Pardon me if I have registered with other username.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...