AltTab Posted July 29, 2013 Posted July 29, 2013 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
BrewManNH Posted July 30, 2013 Posted July 30, 2013 In my signature there's a link to a demo I posted that shows how to do just that. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
AltTab Posted July 30, 2013 Author Posted July 30, 2013 In my signature there's a link to a demo I posted that shows how to do just that. I didnt see a way in the demos to get windowsmessages from a Title or Class like "[CLASS:WebKit_Class]", only GUI windows created through AU3. This is what I am looking to do.
BrewManNH Posted July 30, 2013 Posted July 30, 2013 Totally misread that, search on the forum for WM_COPYDATA which should do what you need. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
AltTab Posted July 31, 2013 Author Posted July 31, 2013 Totally misread that, search on the forum for WM_COPYDATA which should do what you need. I've found this '?do=embed' frameborder='0' data-embedContent>> but I would need a more of an example to understand how i could use WM_COPYDATA, the included example doesnt make sense. Like how would it look to use WM_COPYDATA with notepad?
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