IanN1990 Posted October 12, 2011 Share Posted October 12, 2011 (edited) Heya, I have a media player called KMPlayer. When it goes full-screen, it full-screens in the middle screen "the player is in the left screen by default". I need to have a script that detects when this happens and runs some code I have used the AutoIT Info Tool and found the only 2 variables that are different is the Windows Postion and Size Normal Postion -1701, 0 Size 1701, 1080 Fullscreen Postion 0,0 Size 1920,1080 Is there any way i could use autoit to detect when the Postion or Size differs and then runs my code ?? Idea Code If Window Size >1750 then run code endif but i wouldn't know how to do this ? Any help would be well welcomed Edited April 14, 2012 by IanN1990 Link to comment Share on other sites More sharing options...
kaotkbliss Posted October 12, 2011 Share Posted October 12, 2011 You might be able to use WingetState to let you know if it's maximized or not. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
IanN1990 Posted October 12, 2011 Author Share Posted October 12, 2011 Heya thanks for a reply, I looked at http://www.autoitscript.com/autoit3/docs/functions/WinGetState.htm "i am still very new to this software" It askes for a title, but using the info it doesn't have any static title. It takes the name of the file being played to be the title "I guess i could use the file extection, if .vob, .avi etc" but i donno if this is out of my level Link to comment Share on other sites More sharing options...
kaotkbliss Posted October 12, 2011 Share Posted October 12, 2011 if you can get the class or if it's the active window, then you can use WinGetTitle("[CLASS: ]") or WinGetTitle("[active]") to get the name, then use WinGetState on that result 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
IanN1990 Posted October 12, 2011 Author Share Posted October 12, 2011 Well using ; Check if a new notepad window is minimized $state = WinGetState("[CLASS:Winamp v1.x]", "") ; Is the "minimized" value set? If BitAnd($state, 32) Then MsgBox(0, "Example", "Window is minimized") EndIf it doesn't work I tryed it with 1-16 to make sure the code did work in general and it worked with the correct application "with postive results" but when i used 32, for Max it then fails a bit Link to comment Share on other sites More sharing options...
IanN1990 Posted October 12, 2011 Author Share Posted October 12, 2011 So is there any way i can use the size idea i originally posted? Link to comment Share on other sites More sharing options...
bogQ Posted October 12, 2011 Share Posted October 12, 2011 (edited) $state = WinGetState("[CLASS:Notepad]", "") While 1 $state = WinGetState("[CLASS:Notepad]", "") ToolTip($state) WEnd Test it on your win for notepad its 39 or 47 when maximized depends if win is active or not it returns diffrent number, get states you need from tooltip so that you can see and use them to run the code Edited October 12, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
IanN1990 Posted October 12, 2011 Author Share Posted October 12, 2011 (edited) Well i tryed that code using Winamp v1.x which is the class name for kmplayer using the info tool, and get 15 for both states imgcdn.pandora.tv/pan_img/KMP/Download/kmp.exe is the link of the software if anyone fances trying it out Edited October 12, 2011 by IanN1990 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted October 12, 2011 Share Posted October 12, 2011 So is there any way i can use the size idea i originally posted?Look at WinGetPos() .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
IanN1990 Posted October 12, 2011 Author Share Posted October 12, 2011 Look at WinGetPos() Looking at http://www.autoitscript.com/autoit3/docs/functions/WinGetPos.htm, it seams to be on the right lines but i am not too sure how i write it out to get the postion of my window, and check if its > or < then a value Link to comment Share on other sites More sharing options...
bogQ Posted October 12, 2011 Share Posted October 12, 2011 (edited) dono if this will help you understand WinGetPos, WinGetPos have similar usage like ControlGetPos While 1 $a = ControlGetPos('The KMPlayer','','[CLASS:TSkinPanel; INSTANCE:7]') If IsArray($a) Then $s = WinGetState('The KMPlayer','') If $a[2] = @DesktopWidth And $a[3] = @DesktopHeight And $s = 15 Then ToolTip('MAX ') Else ToolTip('NOT ') EndIf EndIf WEnd personaly i use SMplayer its clean comparing to this KM player that added toolbar and ASK rubish to my comp on instal. Edited October 12, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
IanN1990 Posted October 13, 2011 Author Share Posted October 13, 2011 Well after a few hours playing with ur code i got it working, but it doesn't work when a video is playing Link to comment Share on other sites More sharing options...
bogQ Posted October 13, 2011 Share Posted October 13, 2011 main window change title when you play it, so using ControlGetPos('[CLASS:Winamp v1.x]','','[CLASS:TSkinPanel; INSTANCE:6]') instead ControlGetPos('The KMPlayer', can probbably work i'm shooting blanks heare, if no one can see your code no one can help you to correct error. TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
IanN1990 Posted October 13, 2011 Author Share Posted October 13, 2011 Thanks for putting ur time into this as u guessed the problem was in the title adding ur new code works like a dream 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