Jump to content

Visible text issues


vvb
 Share

Recommended Posts

Hi All,

I have an issue where I am trying to automate an installer (installer is setup factory 7). One of the screens does not have any custom visible text except for the three buttons (back, next and cancel).

I am using WinWait to wait for each screen to appear and using the visible text as an distinguishing feature. Problem is when I store the three button combination as a string, it does not match the visible text. WinGetText returns what looks like the following:

&Next >
&Cancel
< &Back

However, it does not match. And when I do a MsgBox(0, "Test", WinGetText($dlg)) and then use au3info on the messagebox dialog, the visible text is actually:

&Next >[]&Cancel[]< &Back[]

where the [] character is actually a rectangle character.

Question is, is there a way to store the visible text as a constant for later use?

Cheers,

Vlad

Edit:

Fixed the fist code block. Also, I have done some testing and the [] character is actually chr(10) so I've modified the string constant to be:

Const $visTextStr = "&Next >" & chr(10) & "&Cancel" & chr(10) & "< &Back" & chr(10)

I've even done the following test"

If StringCompare(WinGetText($dlg), $visTextStr) = 0 Then
   MsgBox(0, "Test", "Same")
EndIf

And the message box pops up saying they are the same, however, winwait still times out waiting for the screen.

Edited by vvb

I'll be AutoIting my entire system soon.

Link to comment
Share on other sites

have you tried to get the Handle of the Window using its CLASS

orelse could you provide the information given by Au3Info Tool

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Hi phoenixxl. I have not tried using the class format. I don't see a need as it has been fine waiting for 5 of the preceding screens. As it is an installation GUI, each screen has the same dialog title just different visible text. As for info from au3info, the first code block above is what's on the visible text tab of au3info.

I'll be AutoIting my entire system soon.

Link to comment
Share on other sites

Does this help ?

Local $Text = WinGetText($dlg)
If StringInStr($Text, "Next") And StringInStr($Text, "Cancel") And StringInStr($Text, "Back") Then
   MsgBox(0, "Test", "Same")
EndIf

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Hi PhoenixXL,

As mentioned before, stringcompare and stringinstr works but WinWait does not recognise the visible text I pass in.

The following works:

$visText = "&Next >" & chr(10) & "&Cancel" & chr(10) & "< &Back" & chr(10)
Sleep(100)
For $i = 0 to $$DIALOG_WAIT_TIMEOUT - 1
   WinWait($dlgTitle, "", 1)
   $dlgTxt = WinGetText($dlgTitle)
   If StringCompare($dlgTxt, $visText) = 0 Then
      WinActivate($dlgTitle)
      return
   EndIf
   Sleep(1000)
Next
; If we get here then the dialog does not exist
ShowErrorSplash($title, ConstructMissingWindowText($dlgTitle, $visText))

The following does not:

$visText = "&Next >" & chr(10) & "&Cancel" & chr(10) & "< &Back" & chr(10)
sleep(100)
$ret = WinWait($dlgTitle, $visText, $DIALOG_WAIT_TIMEOUT)
if $ret = 0 Then
   ; If we get here then the dialog does not exist
   ShowErrorSplash($title, ConstructMissingWindowText($dlgTitle, $visText))
EndIf
WinActivate($dlgTitle, $visText)

I'll be AutoIting my entire system soon.

Link to comment
Share on other sites

Lot of guess work..!

Can you post the data in the Summary tab of Au3Info tool

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Lot of guess work..!

Can you post the data in the Summary tab of Au3Info tool

Here you go.

>>>> Window <<<<
Title: Test Software Setup
Class: Afx:400000:3:10003:1900015:1802c1
Position: 708, 401
Size: 503, 397
Style: 0x94C80000
ExStyle: 0x00030101
Handle: 0x000202D6
>>>> Control <<<<
Class:
Instance:
ClassnameNN:
Name:
Advanced (Class):
ID:
Text:
Position:
Size:
ControlClick Coords:
Style:
ExStyle:
Handle:
>>>> Mouse <<<<
Position: 707, 485
Cursor ID: 13
Color: 0x85C8FF
>>>> StatusBar <<<<
>>>> ToolsBar <<<<
>>>> Visible Text <<<<
&Next >
&Cancel
< &Back

>>>> Hidden Text <<<<
...
&Help

I'll be AutoIting my entire system soon.

Link to comment
Share on other sites

Does this help in any way

Local $hWnd

$hWnd = WinWait("[CLASS:Afx:400000:3:10003:1900015:1802c1; TITLE:Test Software Setup]", "", 15)
If $hWnd = 0 MsgBox( 16, "Error", "Window Not Found" )

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

From doing some searching on this type of window, it appears that the class may change each time the program is started, one of more of the :#### parts may be different. It might work with a REGEXPCLASS for the window class name instead of hardcoding the class in the WinWait.

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

Hi All,

Thanks for the reponses. However, you are all missing the point. I can wait for the window to popup using WinWait($dlgTitle) but I want to fine tune it to only wait for one with the correct visible text as each screen of the setup wizard has the same tiltle and I don't want to put in a sleep between manipulation of each screen (as if the system is busy, will require more sleep time).

Cheers,

Vlad

I'll be AutoIting my entire system soon.

Link to comment
Share on other sites

Can't you just use the "&Next" as the visible text? You don't need to match all of the text, as long as something shows up in the window that matches everything you're looking for in the Text parameter.

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

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

×
×
  • Create New...