Joshni Posted July 23, 2007 Share Posted July 23, 2007 I am writting a script to uninstall a program. the script executes the .exe program which can see the program is installed and then takes you to a screen that ask you if you want to modify, repair or remove. I would like it to select remove and then click next and finish. The problem I have is that after the .exe file is executed it brings up the second window but it is not in focus. I have to click on the window before it will allow the script to continue. I have written a few simple scripts like this before, but I really have not used this program much. Here is the script I have now. ;launch Driveshield uninstall Run("C:\temp\ds665.exe") WinActivate("Welcome to the DriveShield Setup Maintenance") sleep (5) send ("!e") sleep (5) Send("n") WinWaitActive("Maintenance Complete") Send("{ENTER}") How do I get focus back on the window? I have tried sleep commands but it is not a matter of waiting the focus is not on the window and will not be untill I click on it. Josh Link to comment Share on other sites More sharing options...
GEOSoft Posted July 24, 2007 Share Posted July 24, 2007 (edited) I am writting a script to uninstall a program. the script executes the .exe program which can see the program is installed and then takes you to a screen that ask you if you want to modify, repair or remove. I would like it to select remove and then click next and finish. The problem I have is that after the .exe file is executed it brings up the second window but it is not in focus. I have to click on the window before it will allow the script to continue. I have written a few simple scripts like this before, but I really have not used this program much. Here is the script I have now. ;launch Driveshield uninstall Run("C:\temp\ds665.exe") WinActivate("Welcome to the DriveShield Setup Maintenance") sleep (5) send ("!e") sleep (5) Send("n") WinWaitActive("Maintenance Complete") Send("{ENTER}") How do I get focus back on the window? I have tried sleep commands but it is not a matter of waiting the focus is not on the window and will not be untill I click on it. JoshIf "Welcome to the DriveShield Setup Maintenance" is the correct title (you may want to read about window titles in the help file) then try ;launch Driveshield uninstall Run("C:\temp\ds665.exe") WinActivate("Welcome to the DriveShield Setup Maintenance") While WinActive("Welcome to the DriveShield Setup Maintenance") <> 1 Sleep(1) Wend sleep (5) send ("!e") sleep (5) Send("n") WinWaitActive("Maintenance Complete") Send("{ENTER}") Edited July 24, 2007 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
herewasplato Posted July 24, 2007 Share Posted July 24, 2007 Run("C:\temp\ds665.exe") WinWait("Welcome to the DriveShield Setup Maintenance") WinActivate("Welcome to the DriveShield Setup Maintenance") WinWaitActive("Welcome to the DriveShield Setup Maintenance") Send("!e") Sleep(50) Send("n") WinWait("Maintenance Complete") WinActivate("Maintenance Complete") WinWaitActive("Maintenance Complete") Send("{ENTER}")If that does not work for you, look into the Control Functions. You might be able to use ControlFocus and ControlClick/ControlSend on the last window without ever brining it into focus. -MSP- [size="1"][font="Arial"].[u].[/u][/font][/size] 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