Sign in to follow this  
Followers 0
mrsyok

Need Opinion

6 posts in this topic

Hello.

I need a suggestion on AutoIt Script here.

I've already made a simple script to Send a key in a certain time.

Now i need something that works like this :

If the text that i mention in the script appear on screen, the script will Send a key that i set.

This function works in mIRC script before - ON:TEXT.

Then we list the word that we want, and the reply that we want.

Example :

If, word "fcuk" been typed or appear, the script will automatically kick the user.

It is something like that.

Any idea guys?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If the text that i mention in the script appear on screen, the script will Send a key that i set.

Find a way to read the "screen", look for the text you mention.If matched then Send key.

Then we list the word that we want, and the reply that we want.

List what word for what is it that you want?

There is a tool that Autoit provides called "AutoIt Window Info". Learn how to use it.

and Look for a function in the help file called ControlGetText. They can show you the way to read the screen.

Edited by MiserableLife

Share this post


Link to post
Share on other sites

Find a way to read the "screen", look for the text you mention.If matched then Send key.

List what word for what is it that you want?

There is a tool that Autoit provides called "AutoIt Window Info". Learn how to use it.

and Look for a control in the help file called ControlGetText. They can show you the way to read the screen.

you totally understand what i'm trying to say.. :(

now i got a direction to learn something new. thank you so much for pointing me there.

i will read the help file now and try it rigt away!

thanks again!! :)

Share this post


Link to post
Share on other sites

okay.. here is the script that i made :

Func Action()

While 1

ControlSend ("CLASS:Notepad", "noob", "", Send("1"))

Sleep(2000)

WEnd

EndFunc

i'm using while coz i want this action been repeated.

the problem is, the script keep sending 1 eventhough there is no "noob" word is appear on the screen or been type in notepad.

any idea guys?

and how is CLASS function works? i took it from the original script in AutoIt help.

hope you guys can point me again to the right direction.

thank u.. :(

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

=.=""

the problem is, the script keep sending 1 eventhough there is no "noob" word is appear on the screen or been type in notepad.

The "noob" you put into the ControlSend is for finding the window, not the text.

how is CLASS function works?

Open Help file Autoit -> Using Autoit -> Controls. Read it again.

The Send("1") you put, it should be a string.Doing that will put the Return of Send() into the function.

Here's the proper way to do it(learn from it):

Func Action()
    While 1
        ;Get the Text from notepad and save it to $text
        $text = ControlGetText("[Title:Untitled - Notepad;CLASS:Notepad]", "", "[CLASS:Edit; INSTANCE:1]")
        ;If StringRegExp found "noob" in $text then it will return 1
        If StringRegExp($text,"noob") = 1 Then
            ;Send New Line( @CRLF ) and "I found noob"
            ControlSend ("[Title:Untitled - Notepad;CLASS:Notepad]", "", "[CLASS:Edit; INSTANCE:1]", @CRLF & "I found noob")
            ;If found once, then you will exit the loop and continue with the script
            ExitLoop
        EndIf
        Sleep(2000)
    WEnd
EndFunc

[Title:Untitled - Notepad;CLASS:Notepad]

[CLASS:Edit; INSTANCE:1]

These are extracted from Autoit Window Info.

In the "Window" tab, copy the Title and Class into ControlSend("[Title: here;CLASS: here]",....

In the "control" tab, you copy the Advanced Mode ControlSend("Title","","here"......

If you see there is something written on Text, copy it to ControlSend("Title","here",....

OK?

Now try to click 1 + 5 = on windows calculator with Autoit controlclick. Then you've passed this lesson.

Edited by MiserableLife

Share this post


Link to post
Share on other sites

Owh... the CLASS matter, u mean it from this?

Now i know.. :(

About the script, it works just fine...

I got 1 more question but i have to pm you..

Thanks a lot for the knowledge sir...

Have a nice day...

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