Jump to content

Text Capture


evann
 Share

Recommended Posts

Hello All! Brand new Autoit user here to pick your brains. I have some basic coding/scripting experience, but new to Autoit.

I'm trying to build a script to monitor text in a mud-type game window, and write certain strings to a log file, ignoring the rest of the text. I have no need to send any commands or information. I have made a script that can read a text file and capture and save strings, but I do not know how to capture from the game interface. Any pointers or suggestions where to look for enlightenment?

Evann

Link to comment
Share on other sites

Hello All! Brand new Autoit user here to pick your brains. I have some basic coding/scripting experience, but new to Autoit.

I'm trying to build a script to monitor text in a mud-type game window, and write certain strings to a log file, ignoring the rest of the text. I have no need to send any commands or information. I have made a script that can read a text file and capture and save strings, but I do not know how to capture from the game interface. Any pointers or suggestions where to look for enlightenment?

Evann

I'm happy to enlighten you. You want to computer to read some text. But there is an important difference between text, and text. Let us have a look at the following example:

This is some text.

Posted Image

In fact, both are text for us humans. We can read it just fine, because that's the way we work. We recognize a series of pixels, we see a pattern and match it to a character we already recognize.

However, for a computer; text is much different! A text, or often called a string, for a computer is a list of characters. It's a sequence of bytes. For example the string "abc" is represented (in a common format called ASCII) as 97 98 99. On your screen this is represented to you by a certain pattern of pixels (depending of the font you are using). That's what your game is doing; It represents you these pixels, and these are what you want to read.

However, there is an important realization to make here. Your computer may lose all knowledge of a string, when it is converted to pixels for display on your screen.

We can see the difference here clearly. The following is a sequence of characters, using a font it is turned into pixels, and displayed on your screen. Your computer retains the original meaning of the text, and you can even change the font and the pixels that are shown changes:

This is some text.

This on the other hand:

Posted Image

You can read it as text just fine. However, to your computer this is an image. All references to the original text are lost, because it has been turned into pixels on another machine. Then the pixels have been pushed over a wire, and put on your screen, that's what you're looking at now.

The question for your application now is;

Can you retrieve the text from your game on such a basic level where the computer still has the original text? If that's possible, great! This is an easy job, your computer only needs to relay the information to you.

If that's not possible, we will need to make your computer learn how to read text like a human. It must look at some pixels, and then decide which character is represented there. This is a massively complex task because of all the different fonts, and because it must seperate the background from the text in the foreground. This process is called optical character recognition.

For now, I hope I have shined a shiny light onto your problem and that you will find your own way. If that seems impossible, try to go as far as you can and see if you can ask any more specific questions at that point.

Link to comment
Share on other sites

Thanks for the reply. At this point I'd guess here that the text is available at my end, as the user interface here does have a log function that can be turned on, and generates a basic notepad text file of all the text that scrolls by in the window, both localy generated and received from the server. My problem is, I don't want all of it, just certain strings. Now, I could let it log everything into these monster text files and parse out the pieces I want easy enough, But I'd just as soon do it in one go, and avoid the huge files.

The 'control' that displays the text is as follows, according to autoit window tool (assuming I am using it correctly, of course)

>>>> Control <<<<

Class: ScrollText

Instance: 9

ClassnameNN: ScrollText9

Advanced (Class): [CLASS:ScrollText; INSTANCE:9]

ID: 15051528

Text:

Position: 218, 255

Size: 910, 396

ControlClick Coords: 677, 230

Style: 0x50000000

ExStyle: 0x00000000

Handle: 0x00010276

As far as I can tell it is this control that displays the incoming and outgoing text. As stated before, I don't care to modify either incoming or outgoing, merely monitor and grab certain strings as they are displayed. But... I do not know how to read from this.

Evann

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