Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

VLC Media Player - left click video to pause/play


  • Please log in to reply
No replies to this topic
joelpt
  • Members
  • 23 posts
  • Last active: Dec 09 2011 10:05 PM
  • Joined: 24 Jun 2009
This is a simple script to pause/unpause a video in VLC Media Player with a left click on the video itself. Tested on VLC Media Player 2.0, it should work on 1.x fine though. Requires AHK-L to work, or if you use 'basic' AHK, you could replace the #If's with #IfWinActive's (and SetTitleMatchMode Regex).

SetTitleMatchMode, Regex

;; Left click a video to pause/unpause it in VLC Media Player
#If IsMouseOver("- VLC media player")
~LButton::
    ; Note: VLC window is already active here due to ~ in ~LButton
    MouseGetPos _, _, _, ctrl ; Get name of control under mouse pointer
    if (SubStr(ctrl, 1, 7) == "VLC MSW") ; Is it the VLC video control?
    {
        SendInput, {Space} ; Play/pause VLC
    }
    return
#If

;; Returns true if mouse pointer is over window with given title
IsMouseOver(title)
{
    MouseGetPos _, _, WinID
    return (WinExist(title " ahk_id " WinID))
}