Jump to content

Text recognition


Recommended Posts

Hey Guys,

I am scripting some functions in a window using auto-it. The problem I am having is inside the window, there are different tabs that can be opened. When I use auto-it window info utility, it only recognize the whole window but not the different tabs that open inside the window.( I am not talking abt browsers here).

So, I want to tell auto-it to pause the script till a particular window opens. The only wya I am thinking of is may be pause it till it find a particular text. Is this the only way to do this if so how? If there is any other way, can you please tell me how? Below is my code.

If Not WinActive("Test - Window \\Remote") Then

WinActivate("Test - Window \\Remote"")

EndIf

WinWaitActive("Test - Window \\Remote")

Send("+{ESC}")

Send("!m")

Send("{ENTER 2}")

;-- This is the part where I want to pause the script till a particular text like say " UserName" is displayed.

Send("12345")

Any info is appreciated. Thanks.

Link to comment
Share on other sites

Welcome to the forum.

I have run into this before and I used PixelChecksum to check that the tab of interest was selected. However, that script was just for use on one computer - so if you plan on lots of people using your code, you might have to check the portability of that method.

Also, unless there is code preceding these lines...

If Not WinActive("Test - Window \\Remote") Then

WinActivate("Test - Window \\Remote"")

EndIf

...that makes the script halt until the window is present, then those lines may not be of any use. If you are sure that the Window is present at this point, then that code is okay... Personally, I would skip the If and EndIf and just go ahead and send the WinActivate line.... but that is just me :-)

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Actually I need to run it on diff. computers. But thats better than not having anything. Thank you so much I will look into it.

I see your point reg. if and then. It makes sense. I am not a developer and this is my gig with AUto it. SO, any suggestions will help. Thanks.

Link to comment
Share on other sites

It sounds like this is an AutoIt GUI. Are you just waithing for a certain tab to be open? Something like below.

$hTab = GUICtrlCreateTab(0, 0, 300, 300)
$iTab_1 = GUICtrlCreateTabItem("Item 0")
$iTab_2 = GUICtrlCreateTabItem("Item 1")
$iTab_3 = GUICtrlCreateTabItem("Item 2")

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case -3
            Exit
        Case $hTab
            If GUICtrlRead($hTab) = 2 Then MsgBox(0, "Test Tabs", "You clicked on the second tab")
    EndSwitch
Wend
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Guys, Thank you for the reply.

GEOSof,

Unfortunately, its not Autoit GUI so I cant use what you gave me. But thanks.

TurionALtec,

Unfortunately, its not visible text. its the text on the tab that opens up. AUto It window info doesnt show this tab info. But thanks for the suggestions,

I was pretty excited about AutoIT initially and I got my script going but now I am stuck. Do you guys have any other suggestions?

Link to comment
Share on other sites

I have scripted some apps that ignore the current OS theme and if you carefully select the area to check via PixelChecksum (or even PixelGetColor) then you can use those functions from one computer to the next. I did have to check for the color depth (@DesktopDepth) of each computer :-(

Can you identify the application that you are attempting to script...

...either in this thread or via PM.

[size="1"][font="Arial"].[u].[/u][/font][/size]

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