Friday, December 26, 2014

Facebook Group Poster Script

I admit, I have been bombarded with more than 58 requests asking the same question and I can’t respond individuals so here is the script that all of you were looking for. This is a generic script, you can use it at any Facebook group however just make sure you are using English pages or you will have to do little modifications since script searches for particular terms for locating text areas and buttons:

'--------------------------------------------------------------------------------------------------------
'
'    FB Group Poster
'
'    This script will post text along with images at Facebook groups.
'
'
Set !Timeout_Step 3
Set !Extract_Test_Popup NO

Tag Pos=1 Type=TextArea Attr=Title:Write<sp>something... Extract=Htm
Set !Var1 Eval("var a = '{{!extract}}'.match(/id=.(.+).>Write\s/); a[1];")

Set !ReplaySpeed Medium

' Add text below
EVENT TYPE=CLICK SELECTOR="#{{!Var1}}" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#{{!Var1}}" CHARS="This is first line!\n\nLine2\n\nLine3"

Set !Extract Null

Tag Pos=1 Type=A Attr=data-endpoint:/ajax/composerx/attachment/media/chooser/
Tag Pos=1 Type=Input:File Attr=aria-label:*Photos/Video Extract=Htm
Set !Var2 Eval("var a = '{{!extract}}'.match(/id=.(.+).\sclass=/); a[1];")
Set !Extract Null

' Change path of picture from here or link it through CSV file
Tag Pos=1 Type=Input:File Attr=ID:{{!Var2}} Content=C:\Users\Public\Pictures\Sample<SP>Pictures\Chrysanthemum.jpg

Set !Timeout_Step 1
Tag Pos=1 Type=Div Attr=Class:_1dsp Content=Event:MouseOver
Tag Pos=R-1 Type=Form Attr=* Extract=Htm

Set !Var3 Eval("var a = '{{!extract}}'.match(/id=.(.+).><input\sname=/); a[1];")
Set !Extract Null

Tag Pos=1 Type=Form Attr=ID:{{!Var3}} Content=Event:MouseOver
Tag Pos=R1 Type=Form Attr=* Extract=Htm

Set !Var4 Eval("var a = '{{!extract}}'.match(/id=.(.+).\sonsubmit/); a[1];")
Set !Extract Null

Wait Seconds=40

Tag Pos=1 Type=Button Form=ID:{{!Var4}} Attr=Txt:Post


'--------------------------------------------------------------------------------------------------------

This script will put a simple text and add an image from my document; the good thing is that, you can link this with a csv file using 'Set !Datasource file_name.csv' and post multiple messages with images.