Jump to content

How to read a chat window in real time..?


Recommended Posts

Hi all, i am trying to read a chat window which keeps on changing, I want to read it and place those text into my own list box ,Ok i will explain it ..

I have created an application using autoit to read a chat windwo which keeps on changing ,when ppl talks the caht windwo changes , i want to change the list box in my app to change like the caht windwo i am trying to read...Hope u understand ...

So far i have made a script to read the chat window but the problems is it keeps on adding the same line over and over agin...i dnt know how to stop it from doing it ..i have tried alot , search the forum allmost everyday , does anyone have any udf or something which i can use ...please help me ....

heres what i have done to read the chat window....

while1

$Aread=Controlgettext("chat","",4);----4 is the chat windwo control id which i got from autoit windwo info

sleep(1000);--------to make it lil slower so that it won't go too fast ..

_guictrllistbox_addstring($list1,$Aread)

wend

thats the part im finding difficult , anyone know how to read the caht window in real time , i mean if there isnt any one writing anything the script should pose right, wehn a user send a text the script should read it and put that into list ($list1;---which is my application list box),but my script keep on reading it doesnt stop for anything , sometimes it write the same line 20 times , any ideas ....im confused i have been trying to do this manytimes but no luck ...

Edited by deathday
Link to comment
Share on other sites

Why don't you keep the last line you read in a different variable, and only update your Edit box if the next line you read is differrent to the last one you stored, eg:

$lastread = ""

while1
$Aread=Controlgettext("chat","",4);----4 is the chat windwo control id which i got from autoit windwo info
If $Aread <> $lastread then _guictrllistbox_addstring($list1,$Aread)
$lastread = $ARead
wend

NiVZ

Edited by NiVZ
Link to comment
Share on other sites

Hi all, i am trying to read a chat window which keeps on changing, I want to read it and place those text into my own list box ,Ok i will explain it ..

I have created an application using autoit to read a chat windwo which keeps on changing ,when ppl talks the caht windwo changes , i want to change the list box in my app to change like the caht windwo i am trying to read...Hope u understand ...

So far i have made a script to read the chat window but the problems is it keeps on adding the same line over and over agin...i dnt know how to stop it from doing it ..i have tried alot , search the forum allmost everyday , does anyone have any udf or something which i can use ...please help me ....

heres what i have done to read the chat window....

while 1

$Aread=Controlgettext("chat","",4);----4 is the chat windwo control id which i got from autoit windwo info

sleep(1000);--------to make it lil slower so that it won't go too fast ..

_guictrllistbox_addstring($list1,$Aread)

wend

thats the part im finding difficult , anyone know how to read the caht window in real time , i mean if there isnt any one writing anything the script should pose right, wehn a user send a text the script should read it and put that into list ($list1;---which is my application list box),but my script keep on reading it doesnt stop for anything , sometimes it write the same line 20 times , any ideas ....im confused i have been trying to do this manytimes but no luck ...

Your script does NOT pause if the window doesn't change, you have to code that yourself...

While 1
   $Aread=Controlgettext("chat","",4)
   Sleep(1000)
   _guictrllistbox_addstring($list1,$Aread)
   Do
      sleep(500)
   Until NOT $Aread = Controlgettext("chat","",4)
Wend

try that maybe

Edited by Paulie
Link to comment
Share on other sites

Thanks Nivz and paulie , thanks alot for your reply , I will try for sure and let you know, :unsure: thanks thanks, :D

Actually i am new to autoit , thats why i dnt knw how to make the script stop and all that ,but i have tried my best to get info,i find there isnt any info i can get about autoit , when i want to find anything like say even a simple example of vb i can get so easily , there isnt enough help in help file i would say, and the tutorials provided here by some ppl are helpfull but sometimes we need much more info than those simple tutorials , i have looked for an autoit book but sadely i dnt find any book in any of my countries book shop :P i am ready to pay for it but i couldnt find any book ..sadely ,i have searched the hwole net to see an example book, if you know any site or forum where i can get all the information needed to make complex projects please let me know...Thanks for your replies ,,..thanks thanks ...really appriciate it ..im diying to try ur examples ... thanks .. :D

Link to comment
Share on other sites

$lastread = ""

while1
$Aread=Controlgettext("chat","",4);----4 is the chat windwo control id which i got from autoit windwo info
If $Aread <> $lastread then _guictrllistbox_addstring($list1,$Aread)
$lastread = $ARead
wend

NiVZ can i write that code like below

$Aread=Controlgettext("chat","",4);----4 is the chat windwo control id which i got from autoit windwo info

If $Aread = "" then

return

else

_guictrllistbox_addstring($list1,$Aread)

endif

wend

i dnt know the above code maybe right or not , but i did like that , can u tell me whats the problem if i do that ..? there was a problems wehn i did that

paulie i will test your code today, i will combine both of you codes to see if it works ....thanks

Link to comment
Share on other sites

To add a code snippet you need to type the following:

open square bracket

then the word code

close square bracket

paste in your code

then open square bracket

forward slash (ie /)

then the word code

then close square brackets

Hope that makes sense,

Actually, just realised it might be better to include the $lastread = $ARead inside the IF statement so it only gets updated if something has changed - otherwise it will get updated every time

$lastread = ""

while1
$Aread=Controlgettext("chat","",4);----4 is the chat windwo control id which i got from autoit windwo info
If $Aread <> $lastread then 
_guictrllistbox_addstring($list1,$Aread)
$lastread = $ARead
EndIf
wend

NiVZ

Edited by NiVZ
Link to comment
Share on other sites

well if you get all text in the chat box and make it = $CurrentText

then compair it to $LastText (text from previous read)

compair them and if thier different maybe string replace to get rid of the text in $CurrentText by using $LastText?

Link to comment
Share on other sites

paulie i did what u told me theres a problem when i do that ,Your right when i do that the csript stop reading the same text but it deosnt continue reading chat window , it reads one time only then stops , i dnt knw whats wrong , i even changed the sleep time 500 into different values i thouht it was making it to stop but no hope ...this is all the codes i tried nothing works ....

While 1
   $Aread=Controlgettext("chat","",4)
   Sleep(1000)
   _guictrllistbox_addstring($list1,$Aread)
   Do
      sleep(500)
   Until NOT $Aread = Controlgettext("chat","",4)
Wend

then i tried combining both of you codes like this

$lastread = ""

while1

$Aread=Controlgettext("chat","",4);----4 is the chat windwo control id which i got from autoit windwo info

If $Aread <> $lastread then _guictrllistbox_addstring($list1,$Aread)

$lastread = $ARead

Do

sleep(500)

Until NOT $Aread = Controlgettext("chat","",4)

Wend

then i did it like this

while 1

$Aread=Controlgettext("chat","",4)

sleep(100)

$lastread=Controlgettext("chat","",4)

if $Aread <> $lastread then _guictrllistbox_addstring($list1,$Aread)

wend

Can anyone tell me whats wrong i am doing ....???????please help me .........
Link to comment
Share on other sites

Bam, you mean how , if you have read above , i have clearly said that i am trying to read a chat window,All i want is to update the list box according to the chat window in real time,As you have seen my problems is i cant read it in real time plus i am having difficulty to keep it reading ...

Is there anyone who have created such an application which reads text from a window in real time????? this is the code i try to read but its having problems..i am posting the code so some one might know whats wrong i am doing ,,,thanks ..

$lastread = ""

while1
$Aread=Controlgettext("chat","",4);----4 is the chat windwo control id which i got from autoit windwo info
If $Aread <> $lastread then _guictrllistbox_addstring($list1,$Aread)
$lastread = $ARead
Do
sleep(500)
Until NOT $Aread = Controlgettext("chat","",4)
Wend
:P
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...