qwert Posted October 3, 2018 Posted October 3, 2018 (edited) I thought this would be a simple WinActivate, but it's not turning out that way: WinActivate("[CLASS:MozillaWindowClass]", "") returns a window handle. When I use that handle to check the state of the browser window, it comes back as 15: $WIN_STATE_EXISTS (1) = Window exists $WIN_STATE_VISIBLE (2) = Window is visible $WIN_STATE_ENABLED (4) = Window is enabled $WIN_STATE_ACTIVE (8) = Window is active ... only it's not displayed. But if I request an active notepad window, instead, notepad pops into view. Does anyone know why a browser window would be treated differently? Thanks in advance for any help. Edited October 3, 2018 by qwert
FrancescoDiMuro Posted October 3, 2018 Posted October 3, 2018 3 minutes ago, qwert said: ... only it's not displayed. WinSetOnTop() ? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
qwert Posted October 3, 2018 Author Posted October 3, 2018 Quote Change a window's "Always On Top" attribute. Thanks for your response. I guess I should have included some of the things I've tried ... that being one of them ... although I wasn't comfortable with the idea of changing a window attribute. I've also tried WinMove and a couple of other things from the 25+ threads I've read on calling for a window to display. I guess I'm hoping to hear a method that someone has used that works. Otherwise, there are a lot of possibilities of things to try. (I actually started with a PID lookup method that got very complicated.) I only focused on using the Class: identifier because it gave me results in the most instances.
Danp2 Posted October 3, 2018 Posted October 3, 2018 So you are trying to activate a Firefox window? Have you taken steps to confirm that the handle returned by WinActivate is the correct one? Latest Webdriver UDF Release Webdriver Wiki FAQs
qwert Posted October 3, 2018 Author Posted October 3, 2018 Well, I did notice that the handle it returns doesn't match the one that the info utility displays. I figured it had something to do with having 20 browser tabs open. Any suggestion on how to confirm "correct one"?
Danp2 Posted October 3, 2018 Posted October 3, 2018 You stated that the window isn't visible but you haven't told us why. Is it minimized? Or what? Latest Webdriver UDF Release Webdriver Wiki FAQs
qwert Posted October 3, 2018 Author Posted October 3, 2018 It's certainly not minimized by any user minimize action. Yes, other windows have been opened that are on top of it ... like the SciTE window I'm running ... but if I click the browser's taskbar entry, it comes to the top ... which is exactly how one expects taskbar entries to behave. Yet, any script command to display the browser is ignored.
qwert Posted October 3, 2018 Author Posted October 3, 2018 I found a bit of a clue on the web: Quote WinActivate works great to bring the browser to the front if the title I am looking for is the current tab the user is on. However, if the user has multiple tabs open and the one I am looking for is not the current tab, the the browser is never brought forward. Unless that jogs someone's memory, I'll start looking at WinGetTitle for a possible way.
Danp2 Posted October 3, 2018 Posted October 3, 2018 This works for me -- #include <WinAPISysWin.au3> Local $aList = _WinAPI_EnumWindowsTop ( ) For $i = 1 To $aList[0][0] If $aList[$i][1] = "MozillaWindowClass" Then WinActivate($aList[$i][0]) Exit EndIf Next Latest Webdriver UDF Release Webdriver Wiki FAQs
qwert Posted October 3, 2018 Author Posted October 3, 2018 And it does for me, as well! EnumWindowsTop That's a feature I've never had occasion to use ... but I see how it fits the bill. Thanks for sticking with this. I appreciate your help.
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