Jump to content

Wait for Greyed out button to become active


 Share

Recommended Posts

So I am automating an install of a program. The first part of the install "computes space requirements"

On all of my test machines, this happens quick because they are all clean installs...

In the field, it takes longer and my sleep command sometimes isnt long enough.

So heres what I have tried.

WinWaitActive("reportingclient - InstallShield Wizard")

If Not ControlCommand('report', 'welcome', 'Button3', 'Is Enabled', '') Then

Do

Sleep(10)

Until controlCommand('report', 'welcome', 'Button3', 'Is Enabled', '')

EndIf

'Report" refers to text in the title bar and "welcome" refers to text in the window. Button3 was found using windowinfo and refers to the NEXT button that I need to be active before moving on.

Thanks for any input

Link to comment
Share on other sites

  • Moderators

Hi, wisem2540. What application are you trying to install? The fact that it is an InstallShield installation means it accepts silent parameters, which would save you the hassle of having to click the box.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Hi, wisem2540. What application are you trying to install? The fact that it is an InstallShield installation means it accepts silent parameters, which would save you the hassle of having to click the box.

Man you guys are fast... Actually silent will not work for this install. It is a vendor supported application that, during the install, requires information like ComputerName, Server addresses and so on, that I am using autoit to input

Link to comment
Share on other sites

Try putting Sleep(100) after the WinWaitActive line. Maybe even more sleep, 250 or so.. I use code like this

ControlCommand("Forum Spam List Checker", "", "Button1", "Check") ; 'Click' the Query/Search button
Sleep(250)
Do
    Sleep(100)
Until ControlCommand("Forum Spam List Checker", "", "Button1", "IsEnabled") ; Wait until Search/Query is done

And I found that first Sleep() to be necessary.

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

  • Moderators

Actually silent will not work for this install. It is a vendor supported application that, during the install, requires information like ComputerName, Server addresses and so on, that I am using autoit to input

Yes, but it is an Installshield driven setup, which is industry standard :) You can set global variables, such as ComputerName, Server Address, etc, through your command line.

To answer your initial question, try a sleep of at least 250ms. 10 is nothing.

Edit: somdcomputerguy beat me to the punch ;)

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Yes, but it is an Installshield driven setup, which is industry standard :) You can set global variables, such as ComputerName, Server Address, etc, through your command line.

To answer your initial question, try a sleep of at least 250ms. 10 is nothing.

Edit: somdcomputerguy beat me to the punch ;)

As far as running this silent goes... I would love to be able to do that. However, there is a checkbox in the installer about midway through that was keeping me from being able to use a quiet switch. Couldnt figure out how to make that happen silently....

Link to comment
Share on other sites

"IsEnabled" <> "Is Enabled"

I am assuming you mean I should change my "Is Enabled" to "IsEnabled"??

I tried that with no change. Its still waiting for me to push the next button. Almost like its still sleeping. All I need is an Endif statement right? Nothing else? I tried Endif(commands here) and it errors. So now Endif is all thats on the line...

Link to comment
Share on other sites

Can you post what you get with the AU3Window Info tool when it's over the Next button? Just want to see if maybe the problem is in the parameters you're using rather than how it's laid out.

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

Give this a try:

$timer = TimerInit()
Do
    Sleep(100)
    if TimerDiff($timer) > 10000 then
        MsgBox(0,"","Timeout after 10 secs... do something here :)....") ; adjust to your needs
        ExitLoop
    EndIf
Until ControlCommand("reportingclient - InstallShield Wizard", "", "Button3", "IsEnabled")
Link to comment
Share on other sites

I think the issue might be my 'Welcome' portion. I think it works if I remove that and replace with ''

I will test and let you know. Welcome is obviously in the window as text...isnt that what it is there for? Its designed to search the window for the text "welcome" to make sure it has the right window, no?

Link to comment
Share on other sites

Give this a try:

$timer = TimerInit()
Do
    Sleep(100)
    if TimerDiff($timer) > 10000 then
        MsgBox(0,"","Timeout after 10 secs... do something here :)....") ; adjust to your needs
        ExitLoop
    EndIf
Until ControlCommand("reportingclient - InstallShield Wizard", "", "Button3", "IsEnabled")

Im sorry, would you mind explaining the msgbox? I do not understand the purpose
Link to comment
Share on other sites

That's a good point, try this:

$timer = TimerInit()
Do
    Sleep(100)
    if TimerDiff($timer) > 10000 then
        MsgBox(0,"","Timeout after 10 secs... do something here :)....") ; adjust to your needs
        ExitLoop
    EndIf
Until ControlCommand("reportingclient - InstallShield Wizard", "Welcome", "Button3", "IsEnabled")
Link to comment
Share on other sites

You don't want the script to run forever if the condition is never met. Maybe increase to 30000 (30 seconds), then display a msgbox "Sorry, could not find window blabla..." and then Exit.

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