Sign in to follow this  
Followers 0
IanN1990

[Sloved] Dectection - KMPlayer

14 posts in this topic

#1 ·  Posted (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 :graduated:

Edited by IanN1990

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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 :graduated:


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

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 :graduated:

Share this post


Link to post
Share on other sites

So is there any way i can use the size idea i originally posted?

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
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.

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (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 by IanN1990

Share this post


Link to post
Share on other sites

#11 ·  Posted (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 :graduated: its clean comparing to this KM player that added toolbar and ASK rubish to my comp on instal.

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
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.

 

Share this post


Link to post
Share on other sites

Well after a few hours playing with ur code i got it working, but it doesn't work when a video is playing

Share this post


Link to post
Share on other sites

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 connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
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.

 

Share this post


Link to post
Share on other sites

Thanks for putting ur time into this :graduated: as u guessed the problem was in the title adding ur new code works like a dream ;)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0