Sign in to follow this  
Followers 0
bvr

Reading Text

6 posts in this topic

Say I want to search for certain words in a window, can autoit find letters or text like it does pixel colors?

Share this post


Link to post
Share on other sites



Say I want to search for certain words in a window, can autoit find letters or text like it does pixel colors?

not quite... the only thing that i know of that is capable of doing something like that is "WinGetText()" but that just tells you if the text exists(and doesn't always work) not were it is

Share this post


Link to post
Share on other sites

Can you explain what Insolence's script does, I don't quite understand it, and thats why I thought autoit could read text.

http://www.autoitscript.com/forum/index.ph...c=8442&st=0

This script is an OCR(Optical Character Recongnizer)

it basically pixelschecks for a chain of pixels that coincide in a pattern, it reads text from images,

this is what you'de have to do to read text,

howerver, most OCRs are unreliable and challenging because they are pretty picky as to what to register as a character and what not to.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Say I want to search for certain words in a window, can autoit find letters or text like it does pixel colors?

:D This is untested but borrows from what was said by Paulie and requires that you have found what control might have the text in question. and that it will consistently be that control ID number you get by using the AutoIt Window Info tool found under Start button > All Programs > AutoIt v3

Opt("WinTitleMatchMode", 4)
Global $searchString, $ret, $controlID
$searchString = "my text"
$controlID =;[insert ID found using AutoIt Window Info]
$ret = ControlGetText($myWindow, $searchString, $controlID)
If StringInStr($ret, $searchString) Then
    MsgBox(0, "Success", "Your text is there.")
Else
    MsgBox(0, "Sorry", "Your text was no not found.")
EndIf

Otherwise you could try this:

Opt("WinTitleMatchMode", 4)
Global $searchString, $ret
$searchString = "my text"
$ret = WinGetText($myWindow, $searchString)
If StringInStr($ret, $searchString) Then
    MsgBox(0, "Success", "Your text is there.")
Else
    MsgBox(0, "Sorry", "Your text was no not found.")
EndIf
Edited by Squirrely1

Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites

:D This is untested but borrows from what was said by Paulie and requires that you have found what control might have the text in question. and that it will consistently be that control ID number you get by using the AutoIt Window Info tool found under Start button > All Programs > AutoIt v3

Opt("WinTitleMatchMode", 4)
Global $searchString, $ret, $controlID
$searchString = "my text"
$controlID =;[insert ID found using AutoIt Window Info]
$ret = ControlGetText($myWindow, $searchString, $controlID)
If StringInStr($ret, $searchString) Then
    MsgBox(0, "Sorry", "Your text isn't there.")
Else
    MsgBox(0, "Success", "Your text was no not found.")
EndIf

Otherwise you could try this:

Opt("WinTitleMatchMode", 4)
Global $searchString, $ret
$searchString = "my text"
$ret = WinGetText($myWindow, $searchString)
If StringInStr($ret, $searchString) Then
    MsgBox(0, "Sorry", "Your text isn't there.")
Else
    MsgBox(0, "Success", "Your text was no not found.")
EndIf
He's needing something to read image text not actual text. That's why he referred to the OCR script above.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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