Jump to content

Recommended Posts

Posted

I want to do an operation when I'm passing over with the mouse on the video part of a VLC window.

It has:

Title:VLC

Class: QWidget

Handle: 0x00180926

>>>> Control <<<<

Class: VLC DirectX video

Handle: 0x00050A08

How can I detect when the mouse pass over that 'VLC DirectX video Control' in that 'VLC' window?

Posted

In practice, I want to send a 'Space' inpunt when I click the left mouse button on the film window.

I tried

if WinActive("CLASS:VLC DirectX video") and _IsPressed("01") ) Then

Send ('{Space}')

endif

Posted

In practice, I want to send a 'Space' input when I click the left mouse button on the film window.

I tried:

if WinActive("CLASS:VLC DirectX video") and _IsPressed("01") ) Then 
    Send ('{Space}')
endif

but it doesn't detect the window because that is the name of the control, not the window.

If I put

if WinActive("VLC") and _IsPressed("01") ) Then

it works, but it sends the space also when I click the mouse button on other part of the window where I don't want to send space.

So, how can this be made?

Posted

Maybe something like this

$hwnd = WinGetHandle("VLC")

If WinActive($hwnd) And _IsPressed("01")) Then
    $controlpos = ControlGetPos($hwnd, "", "[CLASS:VLC DirectX video]")
    $Mousepos = MouseGetPos()
    If $Mousepos[0] >= $controlpos[0] And $Mousepos[0] <= $controlpos[0] + $controlpos[2] Then
        If $Mousepos[1] >= $controlpos[1] And $Mousepos[1] <= $controlpos[1] + $controlpos[3] Then
            ControlSend($hwnd, "", "[CLASS:VLC DirectX video]", " ")
        EndIf
    EndIf
EndIf

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted (edited)

Thanks a lot for the code.

Apart for a missing ( after If, it partially works. That is it doesn't work in windowed mode but only in fullscreen mode.

Your code doesn't work in windowed mode, but if I put

_ArrayDisplay($controlpos)

for debug purpose, before $mousepos

it works after the array popup !

Why there's such behaviour and how can I solve this?

Edited by frank10
Posted (edited)

Thank you. Now it works.

EDIT (it works also with Opt("MouseCoordMode", 0))

The only 'problem' is when I want to make a double click.

When you make doubleclick you want to toggle to fullscreen.

To be able to differentiate between the double and single, I made a 250ms Sleep.

If I make less, it's difficult to perform the double, but at 250ms some single click

doesn't recognize.

Is there another way to detect a single or double click:

i.e. single click--> send space, double-->toggle fullscreen ?

Edited by frank10

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
×
×
  • Create New...