martinerskine Posted June 29, 2007 Share Posted June 29, 2007 Hi, Sorry if this has been dealt with before, I have had a look around the forum but cannot find an answer to my problem. I have autoit scripted to install an application that usually pops up a window with Yes and No buttons to reboot the system. I have discovered some PC's that do not pop up this window at the end of the install (probably because they already have some required components, installed). I 'WinWAitActive' (WinWaitActive("App Name - Installation Wizard", "You must restart your system")) for the reboot window to appear therefore, my script is wrong to wait if this window is never to appear on certain PC's! Is there a way to cater for this? Any help much appreciated. ME Link to comment Share on other sites More sharing options...
mikehunt114 Posted June 29, 2007 Share Posted June 29, 2007 Would checking for the window for a given amount of time work? If so, try this after your install is complete. $start = TimerInit() $timer = TimerDiff($start) While $timer < 120000 ;Check for a maximum of 2 minutes If WinExists(("App Name - Installation Wizard", "You must restart your system") Then DoSomething() sleep(100) $timer = TimerDiff($start) WEnd IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] Link to comment Share on other sites More sharing options...
MHz Posted June 29, 2007 Share Posted June 29, 2007 Sounds like a task for Adlib perhaps. ; Add this Adlib in the script where the window may popup. Function "_UnExpectedEvent" will be called every 250ms. AdlibEnable('_UnExpectedEvent') ; You can disable the Adlib later in the script by using this. AdlibDisable() ; And place this function at the bottom of your script out of the way. Func _UnExpectedEvent() If WinExists("App Name - Installation Wizard", "You must restart your system") Then WinWait("App Name - Installation Wizard", "You must restart your system") WinActivate("App Name - Installation Wizard", "You must restart your system") WinWaitActive("App Name - Installation Wizard", "You must restart your system") ; do whatever else needed and then return to body of script EndIf EndFunc 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