Hello this has been my first time using AutoIt and the first sript i have wrote. I'm at a good point at the code where it works as i need it but I had some questions on how to use something like GUIRegisterMsg "_WM_SIZE" with GUIGetMsg, so i can use that to detect the window movement or resize without having to loop like I am with this code. What it is doing is fixing an issue where the hulu plugin through plex cannot read the video unless the window is at max size, so i keep it at max size and pushed off screen and will always restore the window if you display the desktop or minimize the window. The next thing i may want to add is some way to read the raw html being sent to the webkit window that or reading the screen. But I want to try to optimize the code as much as i can right now before i add additional features.
Local $maxsize, $size, $state Opt("WinTitleMatchMode", 2) ;match partial title If WinExists("[CLASS:WebKit_Class]") > 0 Then WinSetState("[CLASS:WebKit_Class]", "", @SW_MAXIMIZE) sleep(500) $maxsize = WinGetPos("[CLASS:WebKit_Class]") ;easy way to get the max size then move the webkit window offscreen WinSetState("[CLASS:WebKit_Class]", "",@SW_RESTORE) WinMove("[CLASS:WebKit_Class]","",@DesktopWidth,0,$maxsize[2],$maxsize[3]) WinSetState("WebKitWorkaround.exe", "", @SW_HIDE) EndIf While WinExists("[CLASS:WebKit_Class]") > 0 $size = WinGetPos("[CLASS:WebKit_Class]") $state = WinGetState("[CLASS:WebKit_Class]") ;ConsoleWrite($state & chr(13) & chr(10)& chr(13) & chr(10) & $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3] & chr(13) & chr(10)) IF $state = 23 Then ;state 23 is when the window is minimzed and video will either stop or never start WinSetState("[CLASS:WebKit_Class]", "",@SW_RESTORE) WinMove("[CLASS:WebKit_Class]","",@DesktopWidth,0,$maxsize[2],$maxsize[3]) EndIf If $maxsize[2] <> $size[2] Or $maxsize[3] <> $size[3] Then ;this will move the WebKit window offscreen and resize to max size WinMove("[CLASS:WebKit_Class]","",@DesktopWidth,0,$maxsize[2],$maxsize[3]) EndIf Sleep(1500) WEnd Exit