Sign in to follow this  
Followers 0
west

totaly new to autoic

16 posts in this topic

Hi all

I explain my situation i am totaly new to autoit

I want to make a bot to advertise rules in a chat room

i am amble to take the main windows active

but now how i can send text in the thext box and click button

I also noticed that i cant send Thai language font and its what i need to send

if somenone have any tutorial or help i can rest i will appreciate

thank a lots

Share this post


Link to post
Share on other sites



Hi all

I explain my situation i am totaly new to autoit

I want to make a bot to advertise rules in a chat room

i am amble to take the main windows active

but now how i can send text in the thext box and click button

I also noticed that i cant send Thai language font and its what i need to send

if somenone have any tutorial or help i can rest i will appreciate

thank a lots

ok I've find out hoe to write thai in note pad at least this is good now

just need know how to use the exact place in a more complex window where to send the text

like in a chat window you have the ext where you read it me i want to send in the text send window and clike SEND button???

Share this post


Link to post
Share on other sites

Read up on the ControlSend() function and check out the Window Info tool that comes with the AutoIt installation.


- Dan [Website]

Share this post


Link to post
Share on other sites

Read up on the ControlSend() function and check out the Window Info tool that comes with the AutoIt installation.

Yes all is fine now

i can make it run and do sned text

but now lol how i make this BOT repaat send text in x sec interval

i need it run always until i disconect from the room

how i can include the windows active stutus in a loop or any other way to do :whistle:

big big thanks

Share this post


Link to post
Share on other sites

Yes all is fine now

i can make it run and do sned text

but now lol how i make this BOT repaat send text in x sec interval

i need it run always until i disconect from the room

how i can include the windows active stutus in a loop or any other way to do :whistle:

big big thanks

ok if find out how to make my loop

bot works but its somewhat messy

now i want to id read the text from a file and put into clipboard to try save the format of the text ( multi lines text) and then paste it into the room

any help on that

clipboard and files i realy dont know at all how to do

i try read the help but so many things so i dont know where to begin

THanks

Share this post


Link to post
Share on other sites

I'm not sure if you'll even need to use the clipboard at all. Read up on the FileOpen() and FileRead() functions in the help file. You should be able to store the text from the file as a variable in the program. As far as keeping it's original format you will probably have to read and send the text file line by line using the FileReadLine() and then ControlSend() functions. I am taking the time to reply to your posts, regardless of the fact that you don't speak the best english, because you state your problem very clearly and ask specific questions which makes it very easy for others here on the forum to help you. Keep up the good work and post back if you have further problems.

P.S. I'd also appreciate checking out the source code of this program when you are finished so that I may learn from your programming techniques and maybe even show you some alternative methods.

-Dan


- Dan [Website]

Share this post


Link to post
Share on other sites

I'm not sure if you'll even need to use the clipboard at all. Read up on the FileOpen() and FileRead() functions in the help file. You should be able to store the text from the file as a variable in the program. As far as keeping it's original format you will probably have to read and send the text file line by line using the FileReadLine() and then ControlSend() functions. I am taking the time to reply to your posts, regardless of the fact that you don't speak the best english, because you state your problem very clearly and ask specific questions which makes it very easy for others here on the forum to help you. Keep up the good work and post back if you have further problems.

P.S. I'd also appreciate checking out the source code of this program when you are finished so that I may learn from your programming techniques and maybe even show you some alternative methods.

-Dan

Yes i am reading it not sure if I am uderstanding well so it will need some time to experiement

I appologize my english is not good at all sorry

from what i am understandting in your last post is i will need to read the .txt file and put the text into a varibale

I will try to do it

but when its time to paste the text into the room i realy need to put in 1 time a few lines of text and then SEND with the button

its make the BOT more clean into the room

as exemble

if i do 1 by 1 with a SEND for each will do this

BOT: welcome

BOT: welcome

BOT: welcome

BOT: welcome

me i want to do this

BOT: welcome

welcome

welcome

welcome

its need paste the 4 lines of text in 1 time and then click SEND in the chat room

P.S of course soon as i will have someting who is not so bad i will paste the code there fo you guys :whistle:

////////////////////////////////////////

also I am planning to do my text in notepad and save the file and try to read it from autoit

but how i can only read the good part of the file to paste in room

i mean i will add many different adverts

as welcome

rules of room

etc etc

how i can be sure to go read the good part in the text file and paste it

i dont want to use 30 000 different text file for every text i want to advert in the chat room

Thank you so much guys

Share this post


Link to post
Share on other sites

Ok i finaly have someting fonctional, its very basic and not exactly what i want but its work

i paste the code there

Dim $RoomName

; Read the ini file "name of room for the bot to connect"

$file = FileOpen("Room_ini.txt", 0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in lines of text until the EOF is reached

While 1

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

MsgBox(0, "Connect to:", $line)

$RoomName = $line

Wend

FileClose($file)

;test pour voir la variable

;MsgBox(0, "Room name is:", $RoomName)

; Wait for the Chat room become active -

WinWaitActive($RoomName)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; open the advert file read it and paste text in the chat room

While 1

$file = FileOpen("Adv.txt", 0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in lines of text until the EOF is reached

While 1

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

;MsgBox(0, "Line read:", $line)

ControlSetText($RoomName, "", "[iD:1042]", $line )

ControlClick($RoomName, "", "[iD:1019]")

sleep(30000)

Wend

FileClose($file)

Wend

Share this post


Link to post
Share on other sites

An IRC based chatroom?

Share this post


Link to post
Share on other sites

An IRC based chatroom?

nope a camfrog video chat room

Share this post


Link to post
Share on other sites

IVE found a problem

if someone in room add a topic

the chat room title will change so the Bot dont work anymore or cannot be started

any clue how to use the window in an another way

????

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

You don't always need the complete title to use a window, if only a portion of the title remains the same that will work too (ie. with Internet Explorer the title always ends with "Internet Explorer". You'd just have to make sure you only have one chat window open or the bot will get confused on which one to use. So maybe the title always begins with "Chat Room - " and then has other text following it that changes (this is just an example). Read the help file and look up the Opt() command the WinTitleMatchMode() parameters. Let me know if you need more help (sorry it took me so long to reply my internet has been going on and off the last couple of days so it's hard to log on).

EDIT: Also if this doesn't work (the entire title changes and you can't use this method) you could try just searching the text of the window for certain text that is always in the window. Just another idea.

Edited by dandymcgee

- Dan [Website]

Share this post


Link to post
Share on other sites

You don't always need the complete title to use a window, if only a portion of the title remains the same that will work too (ie. with Internet Explorer the title always ends with "Internet Explorer". You'd just have to make sure you only have one chat window open or the bot will get confused on which one to use. So maybe the title always begins with "Chat Room - " and then has other text following it that changes (this is just an example). Read the help file and look up the Opt() command the WinTitleMatchMode() parameters. Let me know if you need more help (sorry it took me so long to reply my internet has been going on and off the last couple of days so it's hard to log on).

EDIT: Also if this doesn't work (the entire title changes and you can't use this method) you could try just searching the text of the window for certain text that is always in the window. Just another idea.

yes could be nice if you give me an exemple cause i dont got it even after read

Share this post


Link to post
Share on other sites

yes could be nice if you give me an exemple cause i dont got it even after read

all is fine i've found out :whistle:

Share this post


Link to post
Share on other sites

all is fine i've found out :whistle:

Cool, let me know if you have any other problems.


- Dan [Website]

Share this post


Link to post
Share on other sites

Cool, let me know if you have any other problems.

Yea and then if i want to control the BOT with !start and !stop

any clue ????

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