spyrorocks Posted October 9, 2006 Posted October 9, 2006 OK, after some time of work, here is my PHPBB forum bot. the code is a bit messy though. It is some basic frameowrk of a bot that can post on phpbb forums, any message you like. It could be modefyed to have some sort of AI so you could to some extent make it interact with the users... expandcollapse popup#include <Array.au3> #include<IE.au3> #include <GUIConstants.au3> $Form1 = GUICreate("PHPBB Bot by Spyrorocks", 467, 249, 192, 125) GUICtrlCreateLabel("Root url to forum: ", 8, 8, 88, 17) $text_root = GUICtrlCreateInput("http://spyrorocks.hopto.org:8081/testingforum/", 96, 8, 361, 21, -1, $WS_EX_CLIENTEDGE) $ceck_newtopics = GUICtrlCreateCheckbox("Make New topics?", 8, 48, 121, 17) GUICtrlCreateLabel("Message to post: ", 8, 88, 88, 17) $text_msg = GUICtrlCreateEdit("", 96, 88, 321, 121, -1, $WS_EX_CLIENTEDGE) GUICtrlCreateLabel("Subject:", 128, 48, 43, 17) $text_subject = GUICtrlCreateInput("Hello", 168, 48, 217, 21, -1, $WS_EX_CLIENTEDGE) $Button1 = GUICtrlCreateButton("Start", 184, 224, 75, 25) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $Button1 Case Else ;;;;;;; EndSelect If $msg = $Button1 Then startit() WEnd Exit Func startit() If GUICtrlRead($ceck_newtopics) = $GUI_CHECKED Then $newtopics = 1 Else $newtopics = 0 EndIf $root = GUICtrlRead($text_root) $oIE = _iecreate ($root & "index.php") $subject = GUICtrlRead($text_subject) $msg = GUICtrlRead($text_msg) $source = _IEDocReadHTML ($oIE) $source = StringSplit($source, @CRLF) $ids = _ArrayCreate('') For $i = 1 To $source[0] $str = StringSplit($source[$i], "viewforum.php?f=", 1) If IsArray($str) And $str[1] <> $source[$i] Then $str = StringSplit($str[2], '"', 1) If IsArray($str) And StringIsDigit($str[1]) Then _ArrayAdd($ids, $str[1]) EndIf EndIf Next While 1 $id = Random(_ArrayMin($ids, 1), _ArrayMax($ids, 1), 1) ;$id = 1 If Not $id = 0 Then _IENavigate ($oIE, $root & "viewforum.php?f=" & $id) If $newtopics And Random(1, 5, 1) = 3 Then _IEImgClick ($oIE, "Post new topic", "alt") $oform = _IEFormGetCollection ($oIE, 0) $omsg = _IEFormElementGetObjByName ($oform, "subject") _IEFormElementSetValue ($omsg, $subject) $omsg = _IEFormElementGetObjByName ($oform, "message") _IEFormElementSetValue ($omsg, $msg) $oSubmit = _IEGetObjByName ($oIE, "post", 1) _IEAction ($oSubmit, "click") _IELoadWait ($oIE) Else $source = _IEDocReadHTML ($oIE) $source = StringSplit($source, @CRLF) $tids = _ArrayCreate('') For $i = 1 To $source[0] $str = StringSplit($source[$i], "viewtopic.php?t=", 1) If IsArray($str) And $str[1] <> $source[$i] Then $str = StringSplit($str[2], '"', 1) If IsArray($str) And StringIsDigit($str[1]) Then _ArrayAdd($tids, $str[1]) EndIf EndIf Next $topicid = Random(_ArrayMin($tids, 1), _ArrayMax($tids, 1), 1) If Not $topicid = 0 Then _IENavigate ($oIE, $root & "viewtopic.php?t=" & $topicid) _IEImgClick ($oIE, "Reply to topic", "alt") $oform = _IEFormGetCollection ($oIE, 0) $omsg = _IEFormElementGetObjByName ($oform, "message") _IEFormElementSetValue ($omsg, $msg) $oSubmit = _IEGetObjByName ($oIE, "post", 1) _IEAction ($oSubmit, "click") _IELoadWait ($oIE) $source = _IEDocReadHTML ($oIE) If StringInStr($source, "You cannot make another post so soon after your last; please try again in a short while.") Then Sleep(15000) EndIf EndIf EndIf EndIf WEnd EndFunc ;==>startit Any comments? [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center]
Moderators SmOke_N Posted October 9, 2006 Moderators Posted October 9, 2006 OK, after some time of work, here is my PHPBB forum bot. the code is a bit messy though. It is some basic frameowrk of a bot that can post on phpbb forums, any message you like. It could be modefyed to have some sort of AI so you could to some extent make it interact with the users...Any comments?Maybe an obvious question/comment... Could you explain what exactly someone would use this for? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Uten Posted October 9, 2006 Posted October 9, 2006 Comment: Your test forum is allready down. Probably because people are spamming it like hell by now. Hope you really like it. I ceartanly would not like it if I was the addmin of a PHPBB forum Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
spyrorocks Posted October 9, 2006 Author Posted October 9, 2006 Thats not a real phpbb forum i just pput some random URL there. I guess you could somehow make this into a forum chatbot. [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center]
Uten Posted October 9, 2006 Posted October 9, 2006 I hope nobody will Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
spyrorocks Posted October 9, 2006 Author Posted October 9, 2006 Why? [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center]
Moderators SmOke_N Posted October 9, 2006 Moderators Posted October 9, 2006 Why?I think we are all still waiting to see what "useful" purpose you had in mind when you made this. You say ChatBox() I don't see where it reads "chat" and I don't see any AI to communicate to that chat, so what else was on your mind? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
spyrorocks Posted October 9, 2006 Author Posted October 9, 2006 I said that this is basic frameowrk for a phpbb chatbot. you could inplant some sort of a way to read the last users username and make a comment upon what words are found in the last message. [center] My Projects: Online AutoIt Compiler - AutoForum - AutoGuestbook - AutoIt Web-based Auto Installer - Pure AutoIt Zipping Functions - ConfuseGen - MindReader - P2PChat[/center]
gamerman2360 Posted October 10, 2006 Posted October 10, 2006 Would be cool if you made a program to read through the elements of a page and extract info like posts, usernames, ect.. Then display it in some kind of custom fashon.
the DtTvB Posted October 10, 2006 Posted October 10, 2006 I think it is possible..http://alicebot.org/And to read through the elements of a page, you can use getElementsByTagName, uhh, maybe, _IETagNameGetCollection. [right]Please visit: My biggest project, the DtTvB's AutoIt Web ServerOlder Stuff: A Smoother MouseMove :: AutoIt Syntax Highlighter[/right]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now