frank10 Posted July 4, 2010 Share Posted July 4, 2010 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? Link to comment Share on other sites More sharing options...
frank10 Posted July 5, 2010 Author Share Posted July 5, 2010 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 Link to comment Share on other sites More sharing options...
frank10 Posted July 5, 2010 Author Share Posted July 5, 2010 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? Link to comment Share on other sites More sharing options...
JohnOne Posted July 5, 2010 Share Posted July 5, 2010 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. Link to comment Share on other sites More sharing options...
frank10 Posted July 5, 2010 Author Share Posted July 5, 2010 (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 July 5, 2010 by frank10 Link to comment Share on other sites More sharing options...
JohnOne Posted July 5, 2010 Share Posted July 5, 2010 (edited) I believe Opt("MouseCoordMode", 0) option should be employed. EDIT: Opt("MouseCoordMode", 2) it should be sorry. Edited July 5, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
frank10 Posted July 5, 2010 Author Share Posted July 5, 2010 (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 July 5, 2010 by frank10 Link to comment Share on other sites More sharing options...
JohnOne Posted July 5, 2010 Share Posted July 5, 2010 I would use mode 2 as you will probably find it wont work on the right and bottom of control if its 0 As for your doubleclick, I would use TimerInit() and TimerDiff() functions to check for double click. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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