HockeyFan Posted July 14, 2005 Share Posted July 14, 2005 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 More sharing options...
Developers Jos Posted July 14, 2005 Developers Share Posted July 14, 2005 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 More sharing options...
seandisanti Posted July 14, 2005 Share Posted July 14, 2005 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") = 0sleep(100)wendfiledelete("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 More sharing options...
HockeyFan Posted July 14, 2005 Author Share Posted July 14, 2005 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now