Sign in to follow this  
Followers 0
west

extracting text data

5 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
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.

 

Share this post


Link to post
Share on other sites

$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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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????

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
Sign in to follow this  
Followers 0