Sign in to follow this  
Followers 0
Gaurang

How to get text on dialogbox

12 posts in this topic

Hi guys,

Does anybody knows how to get the text on the dialog box.

I tried

MsgBox(0,"",WinGetText($title))
MsgBox(0,"",ControlGetText($title,"","static1"))

but nothing is working. any suggestion ??

Share this post


Link to post
Share on other sites



Are you sure you have the correct Window Title for $Title?

You should have posted the contents of $Title.


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!"

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Are you sure you have the correct Window Title for $Title?

You should have posted the contents of $Title.

Yeah the $title contains the correct window title.

The whole script is something like this

AutoItSetOption("WinTitleMatchMode","2") 
$title = WinGetTitle("VSMS")
    MsgBox(0,"title",$title);This show the exact title of the window i need to fetch text       
    WinWait($title,"") 
    If Not WinActive($title,"") Then WinActivate($title,"")
    MsgBox(0,"",WinGetText($title)) ; shows empty 
    MsgBox(0,"",controlGetText($title,"","Static1")) ; shows empty

any clue ?? suggestion ???

Edited by Gaurang

Share this post


Link to post
Share on other sites

Yeah the $title contains the correct window title.

The whole script is something like this

AutoItSetOption("WinTitleMatchMode","2") 
$title = WinGetTitle("VSMS")
    MsgBox(0,"title",$title);This show the exact title of the window i need to fetch text       
    WinWait($title,"") 
    If Not WinActive($title,"") Then WinActivate($title,"")
    MsgBox(0,"",WinGetText($title)) ; shows empty 
    MsgBox(0,"",controlGetText($title,"","Static1")) ; shows empty

any clue ?? suggestion ???

Since I have no way of testing it, try adding

AutoItSetOption("WinDetectHiddenText", 1)

To the top of the script.

Also use The Window information tool in the AutoIt folder to verify that the text is actually there.


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!"

Share this post


Link to post
Share on other sites

Since I have no way of testing it, try adding

AutoItSetOption("WinDetectHiddenText", 1)

To the top of the script.

Also use The Window information tool in the AutoIt folder to verify that the text is actually there.

NO LUCK !!! .. still getting blank While dialog box has error message. It's actual a modal dialog box. and appears after I supply the wrong user name or password in authentication dialog box.

Any other suggestion ??

Share this post


Link to post
Share on other sites

"C:\Program Files\AutoIt3\Au3Info.exe" >> This path may differ

bring up the window in question and then click on it. Select everything in the sumary tab ans post it.


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!"

Share this post


Link to post
Share on other sites

"C:\Program Files\AutoIt3\Au3Info.exe" >> This path may differ

bring up the window in question and then click on it. Select everything in the sumary tab ans post it.

I tried it before too... But it show's nothing there too.

Here is what I find in summary window of Au3Info.exe

>>>> Window <<<<

Title: VSMS Validation Error

Class: HwndWrapper[VSMS_GUI.exe;;52c585a2-a362-48e9-bd45-d9cf7ee0e6cf]

Position: 330, 281

Size: 364, 178

Style: 0x16080000

ExStyle: 0x00000000

Handle: 0x00180896

>>>> Control <<<<

Class:

Instance:

ClassnameNN:

Advanced (Class):

ID:

Text:

Position:

Size:

ControlClick Coords:

Style:

ExStyle:

Handle: 0x000206EA

>>>> Mouse <<<<

Position: 430, 329

Cursor ID: 2

Color: 0xEBEBEB

>>>> StatusBar <<<<

>>>> Visible Text <<<<

>>>> Hidden Text <<<<

But dialogox has the text . please see the screenshot.

post-51475-12511954786892_thumb.jpg

Share this post


Link to post
Share on other sites

Do the same thing but this time click on the text itself and before you move the mouse, press Ctrl+Alt+F to freeze the contents and then check the summary tab.


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!"

Share this post


Link to post
Share on other sites

Do the same thing but this time click on the text itself and before you move the mouse, press Ctrl+Alt+F to freeze the contents and then check the summary tab.

Hi Geo,

Following is the output you ask for.

>>> Window <<<<

Title: VSMS Validation Error

Class: HwndWrapper[VSMS_GUI.exe;;d43b6b46-b34a-401d-9528-da698252ffda]

Position: 575, 293

Size: 364, 178

Style: 0x16080000

ExStyle: 0x00000000

Handle: 0x000308B6

>>>> Control <<<<

Class:

Instance:

ClassnameNN:

Advanced (Class):

ID:

Text:

Position:

Size:

ControlClick Coords:

Style:

ExStyle:

Handle: 0x00350496

>>>> Mouse <<<<

Position: 604, 353

Cursor ID: 2

Color: 0x000000

>>>> StatusBar <<<<

>>>> Visible Text <<<<

>>>> Hidden Text <<<<

Share this post


Link to post
Share on other sites

Please guys... please help me in this... It seems like there is no way out.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

It appears to be a non-standard window so I doubt there is a way to get that text.

EDIT Just as an added idea, when the window in question is open, run a script that uses WinList().

#include<array.au3>
$aWins = WinList()
_ArrayDisplay($aWins)

See what windows are actually there.

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!"

Share this post


Link to post
Share on other sites

The window does not seem to follow standard Windows user interface conventions, so AutoIt cannot get that information. PixelGetColor() will probably still work. If you just want to compare the appearance of the dialog (including the text) to something you've predefined, you can do it this way, though it will be slow. You could do a WinGetPos($title) to get the dimensions of the window (left, top, width, height). Then create a loop which will do a PixelGetColor on every pixel within those dimensions and compare them to pixel colors read from a reference file. Be aware, though, that changes made to the appearance of the window, whether in the program or in Windows display settings, could cause the matching to fail. You will have to do some tweaking.

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