HockeyFan Posted May 8, 2006 Share Posted May 8, 2006 HELP! How do I make an active window always stay the topmost active window, even if something else is clicked on the Desktop? Link to comment Share on other sites More sharing options...
seandisanti Posted May 8, 2006 Share Posted May 8, 2006 HELP! How do I make an active window always stay the topmost active window, even if something else is clicked on the Desktop? easy way: Opt("WinTitleMatchMode",4) $aw = WinGetTitle("active") While 1 If WinExists($aw) And Not WinActive($aw) Then WinActivate($aw) Sleep(10) WEnd Link to comment Share on other sites More sharing options...
HockeyFan Posted May 8, 2006 Author Share Posted May 8, 2006 easy way: Opt("WinTitleMatchMode",4) $aw = WinGetTitle("active") While 1 If WinExists($aw) And Not WinActive($aw) Then WinActivate($aw) Sleep(10) WEnd Thank you!!! Link to comment Share on other sites More sharing options...
HockeyFan Posted May 8, 2006 Author Share Posted May 8, 2006 Thank you!!! Ooops...what if I already have Opt("WinTitleMatchMode",3) in my script? Will it only work under option 4?Thanks for your help. Link to comment Share on other sites More sharing options...
HockeyFan Posted May 8, 2006 Author Share Posted May 8, 2006 Also...can you call a Function from within a Function? I already have a Function call running when the window in question is active. Thanks again for your help! Link to comment Share on other sites More sharing options...
HockeyFan Posted May 8, 2006 Author Share Posted May 8, 2006 easy way: Opt("WinTitleMatchMode",4) $aw = WinGetTitle("active") While 1 If WinExists($aw) And Not WinActive($aw) Then WinActivate($aw) Sleep(10) WEnd Ooops...what if I already have Opt("WinTitleMatchMode",3) in my script? Will it only work under option 4? Thanks for your help. Link to comment Share on other sites More sharing options...
HockeyFan Posted May 8, 2006 Author Share Posted May 8, 2006 easy way: Opt("WinTitleMatchMode",4) $aw = WinGetTitle("active") While 1 If WinExists($aw) And Not WinActive($aw) Then WinActivate($aw) Sleep(10) WEnd Also...can you call a Function from within a Function? I already have a Function call running when the window in question is active. Thanks again for your help! Link to comment Share on other sites More sharing options...
RobM Posted May 8, 2006 Share Posted May 8, 2006 easy way: Opt("WinTitleMatchMode",4) $aw = WinGetTitle("active") While 1 If WinExists($aw) And Not WinActive($aw) Then WinActivate($aw) Sleep(10) WEnd Very timely information. I came here to search for this and found it -- Posted today, thanks cameronsdad! Link to comment Share on other sites More sharing options...
seandisanti Posted May 8, 2006 Share Posted May 8, 2006 Ooops...what if I already have Opt("WinTitleMatchMode",3) in my script? Will it only work under option 4?option 4 allows for the "active" substitution in the WinGetTitle("active"). assuming you already know the title of your window, you can just assign that value to the variable, or use the literal string in your WinActive() check. so you don't need to set the option to 4Also...can you call a Function from within a Function?yes, you can call a function from within a function, but i think what you're really asking is can you put this loop into another loop; if this while loop never exits, the outer loop will never continue, effectively hanging your program indefinitely. what you want to do, is just take the statements from inside the sample loop, and toss them into your current loop. that way the check is still performed while the other while loop is running, but you're not killing your script with a never ending loop.Very timely information. I came here to search for this and found it -- Posted today, thanks cameronsdad!no problem, always glad to help. Link to comment Share on other sites More sharing options...
HockeyFan Posted May 9, 2006 Author Share Posted May 9, 2006 yes, you can call a function from within a function, but i think what you're really asking is can you put this loop into another loop; if this while loop never exits, the outer loop will never continue, effectively hanging your program indefinitely. what you want to do, is just take the statements from inside the sample loop, and toss them into your current loop. that way the check is still performed while the other while loop is running, but you're not killing your script with a never ending loop. no problem, always glad to help. Thanks for the info, but I'm still a little confused. My original loop is this: While 1 Sleep(1000) ; Idle around WEnd Do you mean add the sample loop you gave me into the above loop, like this? While 1 Sleep(1000) ; Idle around $aw = WinGetTitle("New Connection Wizard") While 1 If WinExists($aw) And Not WinActive($aw) Then WinActivate($aw) Sleep(10) WEnd WEnd :"> Thanks! Link to comment Share on other sites More sharing options...
seandisanti Posted May 9, 2006 Share Posted May 9, 2006 Thanks for the info, but I'm still a little confused. My original loop is this: While 1 Sleep(1000); Idle around WEnd Do you mean add the sample loop you gave me into the above loop, like this? While 1 Sleep(1000); Idle around $aw = WinGetTitle("New Connection Wizard") While 1 If WinExists($aw) And Not WinActive($aw) Then WinActivate($aw) Sleep(10) WEnd WEnd :"> Thanks!actually, that's precisely what we're trying to avoid, remove the nested "while 1" and "WEnd" and just leave the body of the loop. you also shouldn't need the sleep(10) sincce you already have a sleep in the only while loop that will be left. Link to comment Share on other sites More sharing options...
HockeyFan Posted May 9, 2006 Author Share Posted May 9, 2006 actually, that's precisely what we're trying to avoid, remove the nested "while 1" and "WEnd" and just leave the body of the loop. you also shouldn't need the sleep(10) sincce you already have a sleep in the only while loop that will be left.Thank you...that makes sense...and it works. Thanks so much for your help. Link to comment Share on other sites More sharing options...
seandisanti Posted May 9, 2006 Share Posted May 9, 2006 Thank you...that makes sense...and it works. Thanks so much for your help. no problem. always glad to help 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