NullSpot Posted February 17, 2019 Posted February 17, 2019 Hello! Long time lurker / reader here delving into autoit scripting & I need a little help. I've stumbled through the creation of a script but I've come across an issue I can't really seem to fix. The issue is this, I have MS Edge window that has 3 images / buttons (no code as its JS onclick, which I'm not familiar with) that occur in 3 different places, this window I would like to stay on-top or in focus...or activated. Click 1 button @ 1 location & a new browser window pops up, I minimize it, Button 2 @ a different location, original minimized window pops back up, button 3 same thing The pop-up window has an ever changing title so I'm not sure what / which function to use (I've tried several) that will minimize it after the window loads / activates. Then I would like to activate or focus on the original browser window. This is the code that I currently have that works, however after the sleep periods ANY ACTIVE window (even the desktop) will get minimized. I know the code is sloppy & I probably don't need half the includes & such but I'll clean up once I get the script working.... expandcollapse popup;#RequireAdmin #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <MsgBoxConstants.au3> #include <WinAPIShPath.au3> #include <Misc.au3> #Include <Process.au3> #include <MsgBoxConstants.au3> Opt("WinTitleMatchMode", 1) While 1 ;While Script is running do your job.... Local $hWnd = WinGetHandle("Watch Media Player - Microsoft Edge", "") If WinExists("Watch Media Player - Microsoft Edge") Then WinSetOnTop($hWnd, "", $WINDOWS_ONTOP) ;WinActivate("Watch Media Player - Microsoft Edge") Sleep(100) ;Doesn't seem to be working EndIf ;First Image Location - Get Pixel Color / Look 4 Change Then click $PScoord = PixelSearch(263,695,534,750,6205392) If IsArray ($PScoord) = 1 Then MouseClick ('left', $PScoord[0], $PScoord[1], 1, 0) sleep(5000) ;wait for browser pop-up Local $sText = WinGetTitle("[ACTIVE]") WinSetState($sTexT, "", @SW_MINIMIZE) EndIf $PScoord2 = PixelSearch(263,365,535,419,6205392) If IsArray ($PScoord2) = 1 Then MouseClick ('left', $PScoord2[0], $PScoord2[1], 1, 0) sleep(5000) Local $sText = WinGetTitle("[ACTIVE]") WinSetState($sTexT, "", @SW_MINIMIZE) EndIf $PScoord3 = PixelSearch(263,304,541,359,16777215) If IsArray ($PScoord3) = 1 Then MouseClick ('left', $PScoord3[0], $PScoord3[1], 1, 0) sleep(5000) Local $sText = WinGetTitle("[ACTIVE]") WinSetState($sTexT, "", @SW_MINIMIZE) EndIf ;Local $hWnd = WinGetHandle("?- Microsoft Edge", "") ; WinSetState($hWnd, "", @SW_MINIMIZE) sleep(53000) ;Sleep 53 Seconds & Start Over WEnd The goal or my goal is while the script is running it will cycle through the button's clicking them i.e. > Click Button 1 on the Watch Media Player Window (its blue, on click it grays out) hence pixelsearch coords.... > 2nd Browser window pops up (Again ever changing window title) - it gets minimized for 53 seconds > Watch Media Player should now become active so PixelSearch click the next button(@ the next location) So the Watch Media Player should mostly always be active & the 2nd broswer window always gets minimize after it loads. Any help, tips etc. etc. appreciated & thanks.
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