Sign in to follow this  
Followers 0
Flawblure

Could I do this?

8 posts in this topic

Alright, so I have this piece of code:

Func _ReactToMessage($r_Keyword,$r_End = 0)
    _ParseHTML()
    Do
        _IENavigate($oGK, $reload)
        _IELoadWait($oGK)
        
        If(StringInStr($sWorkVar2, $r_Keyword)) Then
            $r_End = 1
        Else
            _ParseHTML()
        EndIf
        Sleep(30000)
    
    Until $r_End = 1
EndFunc

Which basically just takes the HTML body of the page I'm at, takes out the HTML/javascript through _ParseHTML(), and then looks through whats left for a specific string. This works fine, and I assume it wouldn't be to hard to make this work for an AIM window. So that if someone messages me through AIM, this could scan for a specific keyword in that chat, and if its found then move onto the next line of code.

But here's where I'm a bit stuck.... What I want it to do is that when it scans the AIM chat window, whatever I send to it becomes exactly what it runs.

For instance.... in my main I might have:

_ReactToMessage("43223d")
;Code to be run here

It would search the AIM window for 43223d, which I would make as a sort of password, so that not just anyone could do this unless they included that in there message. BUT, then take the remainder of the message and run that as code.

So if I sent an IM to the computer this script is running on, and the message was: "43223d-Sleep(500)"

Then it would run

_ReactToMessage("43223d")
Sleep(500)

Of course, once it detected 43223d it would leave the _ReactToMessage() function and move onto the next one, in this case, Sleep(500)

But do that with anything, even if I sent "43223d-THISWILLCAUSEANERROR!"

It would run it as

_ReactToMessage("43223d")
THISWILLCAUSEANERROR!

And if an error did occur, it would just restart the loop as though nothing happened.

But this would only happen if it had the _ReactToMessage() code, or in this case, 43223d, in that message.

Share this post


Link to post
Share on other sites



check this post

http://www.autoitscript.com/forum/index.ph...ndpost&p=147400

It is not exactly what you want to do, but I think it will show you the way. I think you will need to copy the text from the message file into a new file and then run the new file. This shows how to copy text to a new file.

Share this post


Link to post
Share on other sites

check this post

http://www.autoitscript.com/forum/index.ph...ndpost&p=147400

It is not exactly what you want to do, but I think it will show you the way. I think you will need to copy the text from the message file into a new file and then run the new file. This shows how to copy text to a new file.

Can you write to a .au3 file? Or would I have to somehow convert a .txt everytime I wanted this to happen?

Share this post


Link to post
Share on other sites

Alright, looked at that page.... I have no idea really what to do.

What I think I need to do is take the window, then ignore any text such as the username and such, and then take the rest and put that into a text file?

Is there a way to do that without saving the HTML of the conversation and then parsing through it like I do to the HTML of a website?

Share this post


Link to post
Share on other sites

Try Call("THISWILLCAUSEANERROR" or "SuperFuncOfDoom").

Share this post


Link to post
Share on other sites

I think you can write to .au3 file (but I have not tried it). I am not familiar with _ParseHTML function. I assumed it generates a text file. What does your parsed output look like (what kind of file)?

Share this post


Link to post
Share on other sites

I think you can write to .au3 file (but I have not tried it). I am not familiar with _ParseHTML function. I assumed it generates a text file. What does your parsed output look like (what kind of file)?

the _ParseHTML() was just in the example... in the end result I would hope to remove it entirely and just read the stuff in directly from an AIM/MSN window or even email view "GetCommandText" or something.

Share this post


Link to post
Share on other sites

Sorry. I do not know much about reading HTML. Maybe someone else can help you.

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