Jump to content

Do...While Loop


Recommended Posts

Can someone help me with how to test for an active window. I have an application that I am installating and when it finishes, I want to know when the "Seteup completed succesfully" window is active, at which time I will send an a command to close the window and continue with the script. Right now I am using the Sleep command to pause execution for a minute and a half. I know the install takes about that long on my test machine but I'm not sure how long it will take on a production machine. I don't want it to time out too soon but I don't want it to wait longer than it has to.

Here is my code:

Do
     Run("C:\Program Files\Network Associates\Common Framework\FrmInst.exe /ForceUninstall", "C:\Program Files\Network Associates\Common Framework", @SW_SHOW)
     Sleep(90000)
     $WinActive = WinGetState("McAfee Agent and Updater Setup", "Setup completed successfully.")
Until @error = 0
     ControlClick ("McAfee Agent and Updater Setup", "Setup completed successfully.", 2, "Left", 1)

The cunfusing part is that the "Installation Progress" window and the "Setup completed successfully" window both have the same title. Is there a better way to identify each individual window?

Any help would be appriciated!

Thanks

Link to comment
Share on other sites

  • Developers

Can someone help me with how to test for an active window.  I have an application that I am installating and when it finishes, I want to know when the "Seteup completed succesfully" window is active, at which time I will send an a command to close the window and continue with the script.  Right now I am using the Sleep command to pause execution for a minute and a half.  I know the install takes about that long on my test machine but I'm not sure how long it will take on a production machine.  I don't want it to time out too soon but I don't want it to wait longer than it has to.

Here is my code:

Do
     Run("C:\Program Files\Network Associates\Common Framework\FrmInst.exe /ForceUninstall", "C:\Program Files\Network Associates\Common Framework", @SW_SHOW)
     Sleep(90000)
     $WinActive = WinGetState("McAfee Agent and Updater Setup", "Setup completed successfully.")
Until @error = 0
     ControlClick ("McAfee Agent and Updater Setup", "Setup completed successfully.", 2, "Left", 1)

The cunfusing part is that the "Installation Progress" window and the "Setup completed successfully" window both have the same title.  Is there a better way to identify each individual window?

Any help would be appriciated!

Thanks

<{POST_SNAPBACK}>

Something like this should do it:

Run("C:\Program Files\Network Associates\Common Framework\FrmInst.exe /ForceUninstall", "C:\Program Files\Network Associates\Common Framework", @SW_SHOW)
WinWait("McAfee Agent and Updater Setup", "Setup completed successfully.")
ControlClick ("McAfee Agent and Updater Setup", "Setup completed successfully.", 2, "Left", 1)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Can someone help me with how to test for an active window.  I have an application that I am installating and when it finishes, I want to know when the "Seteup completed succesfully" window is active, at which time I will send an a command to close the window and continue with the script.  Right now I am using the Sleep command to pause execution for a minute and a half.  I know the install takes about that long on my test machine but I'm not sure how long it will take on a production machine.  I don't want it to time out too soon but I don't want it to wait longer than it has to.

Here is my code:

Do
     Run("C:\Program Files\Network Associates\Common Framework\FrmInst.exe /ForceUninstall", "C:\Program Files\Network Associates\Common Framework", @SW_SHOW)
     Sleep(90000)
     $WinActive = WinGetState("McAfee Agent and Updater Setup", "Setup completed successfully.")
Until @error = 0
     ControlClick ("McAfee Agent and Updater Setup", "Setup completed successfully.", 2, "Left", 1)

The cunfusing part is that the "Installation Progress" window and the "Setup completed successfully" window both have the same title.  Is there a better way to identify each individual window?

Any help would be appriciated!

Thanks

<{POST_SNAPBACK}>

the way that i do stuff like that is i'd make a little temp file like 'c:\done.crap' at the very end of the installation, and rather than sleep for a minute, i'll have a while loop check if the crap file exists....like...

while FileExists("C:\crap.file") = 0

sleep(100)

wend

filedelete("c:\crap.file")

...

<stuff to do after installation goes here so that it executes as soon as the crap file signals that the installation is done>

Link to comment
Share on other sites

Something like this should do it:

Run("C:\Program Files\Network Associates\Common Framework\FrmInst.exe /ForceUninstall", "C:\Program Files\Network Associates\Common Framework", @SW_SHOW)
WinWait("McAfee Agent and Updater Setup", "Setup completed successfully.")
ControlClick ("McAfee Agent and Updater Setup", "Setup completed successfully.", 2, "Left", 1)

<{POST_SNAPBACK}>

WinWait....AWESOME!!! :)

That works great...Thanks. :evil:

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