This script simply emulates Space keypress (Play/Pause function in VLC) when left-clicking on the video (but not any other part of the VLC/Windows interface). Enjoy!
Spoiler
I am trying to create a script for VLC Media Player that will emulate Space keypress (Play/Pause function in VLC) when left-clicking on the video (but not any other part of the VLC/Windows interface). MouseGetPos conveniently retrieves "VLC video output 132456789" as OutputVarControl element when video is clicked.
My script does almost exactly what I want, BUT: whenever I click on the VLC icon in Windows Taskbar, or Windows' Minimize/Maximize buttons of VLC window, {Space} gets sent as well as {LButton} (= VLC window gets minimized/maximized AND video is paused/resumed). This means that both IF and ELSE statements are executed, which leaves me confused.
[EDIT] [SOLVED] The issue was not with the script but with VLC preferences! Somehow I had the "Pause video playback on minimize" option turned on in my VLC Player settings. I think I ticked it by accident without noticing. Disabling this option made script work as expected.
However, there is another significant problem with the above script. Sending {LButton} in the ELSE statament makes it so that you cannot drag anything. I have solved this by removing the ELSE statement alltogether and adding a tilde ~ before the LButton:: hotkey. See the script outside the spoiler for the final, working solution.
Last edited by pureby on 09 May 2021, 11:11, edited 3 times in total.
In many video players, LButton and Space would have the same action in the main player window.
How do you know that Space is sent instead of LButton? If you exit the script and use native LButton, does it have the same actions?
Thank you for the quick reply! I have actually tracked down the issue. It was not related to my script but was a VLC setting! Somehow I had the "Pause video playback on minimize" option turned on in my VLC Player settings. I think I ticked it by accident without noticing. Disabling this option made script work as expected.
There is another significant problem with the script, though. Sending {LButton} in the ELSE statament makes it so that you cannot drag anything. I have solved this by removing the ELSE statement alltogether and adding a tilde ~ before the LButton:: hotkey.
Now script in the OP works perfectly: video is Paused/Resumed when clicking on the video, all other VLC/Window/Taskbar/Mouse controls work unchanged.