Jump to content

Watch a window and start programm if a special word appears


Recommended Posts

Hi,

I'm having a question, if the following can be done with AutoIT or if I need continue to search for a different solution.

What I need: Something that is watching a mIRC (IRC client) window. And when some defined words appear, an external windows programm should be started. And this in an endless loop.

Regards,

Lola

Link to comment
Share on other sites

You can absolutely do that within AutoIt. Check out ControlGetText and StringInStr

-Fett

[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]
Link to comment
Share on other sites

Should be possible. I do this with Acrobat distiller (waits for the word "ready" to know when it is finished and closes the app)

While 1

your code

Wend

puts the code into an infinate loop (you will want to use Hotkeyset() to make a way to stop/pause the script)

WingetText() to read text from the window

Run() to run your app

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

Thanks for the information.

I meanwhile played a little bit around. If I try reading the text from the command field I get it:

$var = ControlGetText("[CLASS:mIRC]", "", "[CLASS:RichEdit20W; INSTANCE:1]")

MsgBox(4096, "Test", $var)

But when I try to read the text from the mIRC main chat log window, I just get an empty string by using:

$var = ControlGetText("[CLASS:mIRC]", "", "[CLASS:Static; INSTANCE:1]")

MsgBox(4096, "Test", $var)

Any idea what could be wrong?

Link to comment
Share on other sites

kaotkbliss had the better suggestion with WinGetText, try that and see what happens.

-Fett

P.S. Was looking at your ControlGetText code. You might try that again, but actually just use the Window Title for the first var in the ControlGetText function instead of the class name.

Edited by fett8802
[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]
Link to comment
Share on other sites

The Window Title instead of the class name also gives me an empty string.

WinGetText retrieves the window title and the text that is currently in the command field. But not the main

This is a screenshot of the window:

http://img703.imageshack.us/i/unbenanntml.png/

The big main window text I want to search for words - or at least get into a variable at the beginning.

The small line at the bottem (command line) is the only I can get the text out from.

Link to comment
Share on other sites

Doesn't MIRC have logging? If it does, you can continuously scan the log file for the file if you can't grab it from the window itself.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

i tried this

#Include <GuiRichEdit.au3>
$control=ControlGetHandle('[CLASS:mIRC]','' ,'[CLASS:RichEdit20W; INSTANCE:1]')
$test=_GUICtrlRichEdit_GetText($control)
$i = @error
ConsoleWrite($test)
Exit($i)

unfortunately it returns rc:700 when it tries to send a msg to the control and the external application crashes, kinda expected that would happen but yah worth the try anyways :)

Link to comment
Share on other sites

Doesn't MIRC have logging? If it does, you can continuously scan the log file for the file if you can't grab it from the window itself.

Yes MIRC can indeed live log to text, I would enable that feature and scan the text file as you suggest for the word in question. *Glares at evil controls that do not provide their content to the greater environment*

-K

-K

Link to comment
Share on other sites

Yes MIRC can indeed live log to text, I would enable that feature and scan the text file as you suggest for the word in question. *Glares at evil controls that do not provide their content to the greater environment*

-K

agreed controls containing non-plain-text can be a pain, a function that can get text from an externalIE or Richtext control would be very nice.

Think ill have a few go's at that =]

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