Dessan

How to pass msgs fm facebook, forum etc to GUI, write back answer and pass back to facebook, forum etc

7 posts in this topic

#1 ·  Posted

Hi guys!

I am a newcomer and know Autoit language very little. I intend to "download" messages fm forum or any social net to my GUI active window tool like Label etc, read them, write answer and using some kind of button - pass it back to forum or any social net. The problem is I don`t know how and where to start it. First of all I have working GUI chat window with two labels and I can write in one and receive what I have written in the other. I need to connect now this GUI to smth. First of all I tried to open an HTML page in the GUI but receive a message that I need to install Javascript or download a browser...Now I think I need to find some descriptors of HTML text windows and pass them to GUI...but really don`t know how to do it. But I also think I am completely in the wrong way...Pls advise me.

Share this post


Link to post
Share on other sites



#2 ·  Posted

I want to add that there is no need in code, I just want the method of implementation, may be some examples

Share this post


Link to post
Share on other sites

#3 ·  Posted

You say there is no need in code, but this forum is dedicated to helping people with their scripts; it is not a place where we spoon-feed you code. What have you tried on your own? As you are looking for a place to start, I would suggest:

  • reading through the help file on GUI creation
  • searching the forum for threads on interacting with webpages
  • try the examples in the help file to understand how they work, and then try to modify them to your own needs.

Once you have done these, and have some code of your own, feel free to post it here to ask for assistance if you get stuck. 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#4 ·  Posted

Ok, if you wish so here is my script with GUI Chat. It receives input text and if the text matches the database - it gives the random answer.

Spoiler
#include <GUIConstants.au3>
#include <Array.au3>

Local $hGui, $Input, $Label, $BtnOk, $Text, $Data, $sRead, $iListView

Opt("GUIOnEventMode", 1)

HotKeySet('{Esc}', '_Quit')
;~ HotKeySet('{ENTER}', '_Button1')

$hGui = GUICreate("GUI", 700, 300, 300, 200, $WS_OVERLAPPEDWINDOW + $WS_POPUP)
$Label = GUICtrlCreateEdit("", 10, 5, 600, 200, BitXOR($ES_READONLY, $WS_HSCROLL, $WS_VSCROLL))
$Input = GUICtrlCreateEdit('', 10, 210, 600, 50, BitXOR($GUI_SS_DEFAULT_EDIT, $WS_HSCROLL))
$BtnOk = GUICtrlCreateButton('Send', 620, 210, 70, 26)
GUICtrlSetOnEvent(-1, '_Button1')
GUICtrlSetState($Input, $GUI_FOCUS)


GUISetState(@SW_SHOW)

While 1
    Sleep(500)
WEnd

Func _Button1()
    $Text = GUICtrlRead($Input)
    GUICtrlSetData($Label, 'Char: ' & $Text & @CRLF, 1)
    GUICtrlSetData($Input, '')
    Call("_aP01")
EndFunc   ;==>_Button1

Func _aP01()

    Local $sSource[5] = ["one", "two", "three", _ ;0-2
            "five", "seven"] ;3-4
    For $i = 0 To 4

        $k = StringInStr($Text, $sSource[$i])

        If $k > 0 Then

            $Text = StringMid($Text, StringInStr($Text, $sSource[$i]), StringLen($sSource[$i]))
            ExitLoop

        ElseIf $k = 0 Then
            $i = $i

        EndIf
    Next

    Local $aAnswer[8] = ["yes", "true", "si", "oui", _ ; 0-3
            "no", "nein", "ne", "non"] ; 4-7

    Switch $Text
        Case "one", "two", "three"
            MsgBox(0, "", $aAnswer[Random(0, 3, 1)])

        Case "five", "seven"

            MsgBox(0, "", $aAnswer[Random(4, 7, 1)])
        Case Else
            MsgBox(0, "", "Oops!")
    EndSwitch
EndFunc   ;==>_aP01

Func _Quit()
    Exit
EndFunc   ;==>_Quit

 

I want to connect my GUI to social net or some chat and get messages from users exactly to my GUI, read them and answer or if it receives some text that matches the database - it will give the prepared random answer. Smth like you receive the "I`m busy , call me later" automessage when you call a friend and he/she is busy. Or, for example. communicate in this way in a game chat. But I don`t know how to do it. Hope you understand my problem.

Share this post


Link to post
Share on other sites

So...no any ideas?No suggestions?

Share this post


Link to post
Share on other sites

If you want to do this, I suggest you do it through the API of the site you're trying to pull data from. Navigating using a webpage is going to be complicated, and a lot of these sites will let you directly access your messages through an API. For example, a quick Google search gave me this documentation for Facebook and Facebook Messenger.

1 person likes this

UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=

Share this post


Link to post
Share on other sites

Understood, thank you

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