Stuempi Posted June 2, 2009 Share Posted June 2, 2009 Hi there... I'm sure this is just a minor problem, but I'm obviously to dumb to see the answer myself So I got a niftly little uninstallation of a program... Window A pops up ("Remove Programs From Your Computer") and the uninstallation is beginning to run with a progress bar... after about 10% if COULD BE that a window appears ("Remove Shared File?") about some kind of shared files which I want wo agree by pressing enter. Otherwise I want to wait till the uninstallation is completed and then want to press enter. Run('C:\WINDOWS\IsUninst.exe -f"C:\Programme\test\Uninst.isu"') WinWaitActive("Confirm File Deletion", "") Send("{ENTER}") If WinActive("Remove Shared File?","") Then Send("{Enter}") WinWaitActive("Remove Programs From Your Computer","") Sleep(5000) Send("{Enter}") Else WinWaitActive("Remove Programs From Your Computer","") Sleep(5000) Send("{Enter}") EndIf Exit But obviously this isn't working as intended... I hope you guys get me and have a nice idea how to solve this little problem... Link to comment Share on other sites More sharing options...
Developers Jos Posted June 2, 2009 Developers Share Posted June 2, 2009 (edited) Would something like this work for you? Run('C:\WINDOWS\IsUninst.exe -f"C:\Programme\test\Uninst.isu"') While 1 If WinExists("Confirm File Deletion", "") Then Send("{Enter}") If WinExists("Remove Shared File?", "") Then Send("{Enter}") If WinExists("Uninstall Completed (or something like that???)", "") Then Sleep(5000) Send("{Enter}") ExitLoop EndIf Sleep(50) WEnd Exit Edited June 2, 2009 by Jos 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...
PsaltyDS Posted June 2, 2009 Share Posted June 2, 2009 (edited) Hi there... I'm sure this is just a minor problem, but I'm obviously to dumb to see the answer myself So I got a niftly little uninstallation of a program... Window A pops up ("Remove Programs From Your Computer") and the uninstallation is beginning to run with a progress bar... after about 10% if COULD BE that a window appears ("Remove Shared File?") about some kind of shared files which I want wo agree by pressing enter. Otherwise I want to wait till the uninstallation is completed and then want to press enter. Run('C:\WINDOWS\IsUninst.exe -f"C:\Programme\test\Uninst.isu"') WinWaitActive("Confirm File Deletion", "") Send("{ENTER}") If WinActive("Remove Shared File?","") Then Send("{Enter}") WinWaitActive("Remove Programs From Your Computer","") Sleep(5000) Send("{Enter}") Else WinWaitActive("Remove Programs From Your Computer","") Sleep(5000) Send("{Enter}") EndIf Exit But obviously this isn't working as intended... I hope you guys get me and have a nice idea how to solve this little problem... One way is to have an AdLibEnable() function that periodically checks for the popup and handles it: AdlibEnable("_PopupGuard", 500); Test for popup every .5sec Run('C:\WINDOWS\IsUninst.exe -f"C:\Programme\test\Uninst.isu"') WinWaitActive("Confirm File Deletion", "") ControlSend("Confirm File Deletion", "", "", "{ENTER}") WinWaitActive("Remove Programs From Your Computer", "") Sleep(5000) ControlSend("Remove Programs From Your Computer", "", "", "{Enter}") Func _PopupGuard() If WinExists("Remove Shared File?", "") Then WinActivate("Remove Shared File?", "") ControlSend("Remove Shared File?", "", "", "{Enter}") Sleep(1000); Give it time to go away EndIf EndFunc ;==>_PopupGuard I also recommend you use ControlSend() vice Send(), but that's optional. Edit: Rats! Beaten to it by the Jos-bot! Edited June 2, 2009 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Stuempi Posted June 2, 2009 Author Share Posted June 2, 2009 I think I got the idea from both of you, but didn't get Jos' Code working I'm new to all this and I'm not sure about the expression "1" as in the help file it's declared as "if the expression is true the code is run till WEnd. The loop continues until the expression isn't true"... ^_°PsaltyDS's code solved my problem Many thanks to both of you. Link to comment Share on other sites More sharing options...
Inverted Posted June 2, 2009 Share Posted June 2, 2009 (edited) @ Stuempi That's why Jos uses the ExitLoop as the only way to stop the while loop (otherwise it will run forever, yes) Don't doubt the developer Edited June 2, 2009 by Inverted 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