Jump to content
Sign in to follow this  
Welly

How to check for window when there are two possibilities?

Recommended Posts

Welly

Hi all,

I'm new to AutoIt so please bear with me.

I'm using this to automate a software update installation on multiple clients.

This is the code I'm having problem with :

        $win =  WinWait( $varGL_InstallerTitleText,  "Installation completed successfully"   )

        ControlClick( $win  , "Installation completed successfully" , "[NAME:m_cancel]" )

 

The issue is that is that is final state in the update window and somehow there's two possibilities for the text. It can be "Installation completed successfully" or it can be "Installation completed", depends on what component is updated. I'm reluctant to put a timeout delay because before we got to that final state there's an update process which I'm not sure how long it takes (depending on the spec of the client, which is vary).

Any suggestions on how to approach this? Thanks heaps.

Welly

Share this post


Link to post
Share on other sites
hydranix

There is a very complete help file that answers this question.

 

 -------8<--------

If the same notepad window had, "This is some text!" typed into the window, the Window Info Tool would show:

 -------8<--------

WinWaitActive("Untitled - Notepad", "This is some text!")

Window Text

The window text consists of all the text that AutoIt can "see". This will usually be things like the contents of edit controls (as above with "This is some text!") but will also include other text like:

  • Button text like &Yes, &No, &Next (the & indicates an underlined letter)
  • Dialog text like "Are you sure you wish to continue?"
  • Control text
  • Misc text - sometimes you don't know what it is :)

The important thing is that you can use the text along with the title to uniquely identify a window to work with.

When you specify the text parameter in a window function it is treated as a substring. So for the example above if you used the text "is some " you would get a match.

 

What has been described is the default mode in which AutoIt operates. There are a number of more advanced modes to use when things are not as simple as this.

 

Note: Hidden windows can be matched by "title" only if "text" is empty ("").

Source

Edited by hydranix

Share this post


Link to post
Share on other sites
Exit

Just use start of text

$win =  WinWait( $varGL_InstallerTitleText,  "Installation compl"   )

 


My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

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  

×