Sign in to follow this  
Followers 0

Do...While Loop

4 posts in this topic

#1 ·  Posted

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

Share this post


Link to post
Share on other sites



#2 ·  Posted

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)

Visit the SciTE4AutoIt3 Download page for the latest versions                                                                 Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted

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>


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#4 ·  Posted

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:

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