Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Do...While Loop


  • Please log in to reply
3 replies to this topic

#1 HockeyFan

HockeyFan

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 293 posts

Posted 14 July 2005 - 03:53 PM

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







#2 Jos

Jos

    Je maintiendrai

  • Developers
  • 23,445 posts

Posted 14 July 2005 - 03:59 PM

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


#3 seandisanti

seandisanti

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 2,927 posts

Posted 14 July 2005 - 04:10 PM

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

#4 HockeyFan

HockeyFan

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 293 posts

Posted 14 July 2005 - 04:41 PM

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:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users