west Posted September 9, 2007 Share Posted September 9, 2007 hello all I am having trouble extracting the data i need i am in the way to try make a trivia bot for a chat room my problems is now i can read the last line of text in the chat room ( i use an another code ive found there called ChaTLion) but ive got some problem is a users send several lines of text i only can get the last one if there a way to grasp all the lines a userts type see the code ;set empty prevline var used later to check against new text $prevline = "" $prevline2 = "" ; Begin loop $l = 0 While 1 ; Read from the chat window bon ca ca compte les lignes the texte dans la room apres avoir mouse clicker sur le main chat ;$totallines = ControlCommand($RoomName, "", "RichEdit20A1", "GetLineCount", "") $totallines = ControlCommand($RoomName, "", "RichEdit20A1", "GetLineCount", "") $currentline = ControlCommand($RoomName, "", "RichEdit20A1", "GetLine", $totallines -1) $currentline2 = ControlCommand($RoomName, "", "RichEdit20A1", "GetLine", $totallines -2) ; Check for new text If $prevline <> $currentline Then ; Store current text for check against new text $prevline = $currentline $prevline2 = $currentline2 ; Write to the LOG FILE ; OPEN the LOG FILE $file = FileOpen(@DesktopDir & "\AnyFileNameHere.txt",128 + 1) FileWrite($file, $prevline & @CRLF) FileClose($file) EndIf it is only a begining as i will need to add the text and users name in a DB for calculate the points so my question is how i can find all the lines of text and the users ID ex: NICK123 : blaaaa blaaa blaaa hihihihihihihihihihihihihi ererererere in this its 3 lines oh i can graps the 3 lines ans also the ID before the : thanks Link to comment Share on other sites More sharing options...
bogQ Posted September 9, 2007 Share Posted September 9, 2007 (edited) $file = FileOpen("log.txt", 0) While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $split = StringSplit($line, ":") If @error <> 1 Then MsgBox(0,"",$split[1]) MsgBox(0,"",$split[2]) MsgBox(0,"",$split[3]) EndIf If @error = 1 Then MsgBox(0,"",$line) EndIf Wend like this? Edited September 9, 2007 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
west Posted September 9, 2007 Author Share Posted September 9, 2007 $file = FileOpen("log.txt", 0) While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $split = StringSplit($line, ":") If @error <> 1 Then MsgBox(0,"",$split[1]) MsgBox(0,"",$split[2]) MsgBox(0,"",$split[3]) EndIf If @error = 1 Then MsgBox(0,"",$line) EndIf Wend like this?mmm this seem more a way to to read ans search into the file I am at the step before i want to write into the file what i extract i can do it but unfortunaly only the last line of text fromt he chat room i try find a way to extract x lines of text by users its can be 1 to x lines depand what they type Link to comment Share on other sites More sharing options...
west Posted September 9, 2007 Author Share Posted September 9, 2007 mmm ive find out is the chat window is open at full its fine i can graps all the text its only when the chat windows is customised smaller and the line of text overlap into multiple line that its dont work Link to comment Share on other sites More sharing options...
west Posted September 10, 2007 Author Share Posted September 10, 2007 this code using a file may i use it live in the script i mean dont need to write or read the file to find the users ID and his text???? Link to comment Share on other sites More sharing options...
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