PcExpert Posted March 18, 2007 Share Posted March 18, 2007 Hello, Is it possible to run more winwaitactive's at once? So the program wont only wait for a window called 'I am here' but it will also wait for a window called 'you are there'. Thanks! Link to comment Share on other sites More sharing options...
Developers Jos Posted March 18, 2007 Developers Share Posted March 18, 2007 Hello,Is it possible to run more winwaitactive's at once? So the program wont only wait for a window called 'I am here' but it will also wait for a window called 'you are there'.Thanks!No, but you can build a loop with a number of " If WinExists()" in it .... 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...
PaulIA Posted March 18, 2007 Share Posted March 18, 2007 Hello,Is it possible to run more winwaitactive's at once? So the program wont only wait for a window called 'I am here' but it will also wait for a window called 'you are there'.Thanks!Write your own function that accepts an array of window titles and loops using WinExists/WinActive to determine if one of the windows exists and is active. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 18, 2007 Moderators Share Posted March 18, 2007 Hello, Is it possible to run more winwaitactive's at once? So the program wont only wait for a window called 'I am here' but it will also wait for a window called 'you are there'. Thanks!Dim $aWins[4] = ['', 'This Window', 'That Window', 'Some Other Window'] _WinWaitMulti($aWins, 5) Func _WinWaitMulti($aArray, $nTime = 0) If IsArray($aArray) = 0 Then Return SetError(1, 0, 0) Local $iTimer = TimerInit() While 1 Sleep(100) For $iCC = 1 To UBound($aArray) -1 If WinActive($aArray[$iCC]) Then Return $aArray[$iCC] Next If $nTime And (TimerDiff($iTimer) / 1000) >= $nTime Then Return SetError(2, 0, 0) WEnd EndFunc Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MHz Posted March 19, 2007 Share Posted March 19, 2007 Regex is an option... Opt('WinTitleMatchMode', 4) Opt('WinWaitDelay', 2000) For $i = 1 To 10 Switch Random(1, 3, 1) Case 1 Run('explorer "' & @ProgramFilesDir & '"') Case 2 Run('explorer "' & @WindowsDir & '"') Case 3 Run('explorer "' & @SystemDir & '"') EndSwitch If Not WinWaitActive('regexp=(?i)program files|windows|system32', '', 3) Then ExitLoop $title = WinGetTitle('regexp=(?i)program files|windows|system32') WinClose($title) Next Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 19, 2007 Moderators Share Posted March 19, 2007 Hmmm... Nice option MHz... but why not just use $title = WinGetTitle('') after the WinWaitActive()? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MHz Posted March 19, 2007 Share Posted March 19, 2007 Hmmm... Nice option MHz... but why not just use $title = WinGetTitle('') after the WinWaitActive()?Thanks. Why, cause that leaves an element of risk for another title to jump in on the act. I have not used this regexp concept in reality as Adlib() or a loop with WinExist() normally does ok to cover for multiple windows to target. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 19, 2007 Moderators Share Posted March 19, 2007 Thanks. Why, cause that leaves an element of risk for another title to jump in on the act. I have not used this regexp concept in reality as Adlib() or a loop with WinExist() normally does ok to cover for multiple windows to target.My only concern was that WinGetTitle('') directly is going to get the immediate active window once WinWaitActive() is done and has not failed. However, if I'm reading your regexp right, it's going to get any of those titles (active or not) and close that window (the first one it finds). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MHz Posted March 19, 2007 Share Posted March 19, 2007 My only concern was that WinGetTitle('') directly is going to get the immediate active window once WinWaitActive() is done and has not failed. However, if I'm reading your regexp right, it's going to get any of those titles (active or not) and close that window (the first one it finds).WinActive() can be used in many more lines of code that can be added but I am not going to go into making a big example out of it just to show that it can work with assurance of handling the correct window. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 19, 2007 Moderators Share Posted March 19, 2007 WinActive() can be used in many more lines of code that can be added but I am not going to go into making a big example out of it just to show that it can work with assurance of handling the correct window. I tested it... It looks like it went in last active... nice... I love it when I learn something new Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
PcExpert Posted March 19, 2007 Author Share Posted March 19, 2007 Is it poosible to do something with winTitlematchmode? Like this: WinWaitActive("this site that site my site") So it will just wait for a website that has one or more specified keywords? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 19, 2007 Moderators Share Posted March 19, 2007 Is it poosible to do something with winTitlematchmode? Like this: WinWaitActive("this site that site my site")So it will just wait for a website that has one or more specified keywords?MHz showed you regexp= with Opt('WinTitleMatchMode', 4).... But... I was under the impression that Opt('WinTitleMatchMode', 2) did what you were asking... Is your help file broken again or just being lazy as usual? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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