Jump to content

VLC player control

Recommended Posts



all I want to do is control VLC player without it being the active window.

I tried this, but that only works if VLC is the active window:

$VLC = WinGetHandle("[CLASS:QWidget]")

Strange thing is I tried similar thing with AutoHotkey and it works like a charm so there has to be a way.



(I checked the VLC UDF but as far as I see it does not interacts with VLC itself, rather it opens "a new VLC" using InternetExplorer. This is not what I want to do.)


EDIT: for some reason this works. Can someone explain why?

HotKeySet("{F5}", "Pause")

$VLC = WinGetHandle("[CLASS:QWidget]")

While 1

Func Pause()

EDIT2: huh, did some testing and if I run the script and use F5 without VLC not being active first, it will not work even when I make VLC active. However, when I run the script make VLC active, press F5 then i works like it should, VLC can be minimized, made not active. Why?

EDIT3: when using Ctrl+V it only works when the window is active, despite what I wrote in EDIT2. This is mingboggling

Func Pause()


Edited by Seminko

Share this post

Link to post
Share on other sites

You do have vlc's hotkeys you could use.

What else do you need that isn't present in vlc's hotkeys?

EDIT: oh and by the way, your code works here. Active previously or not, it always pauses and continues with F5.

Edited by careca


Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples


Share this post

Link to post
Share on other sites

Don't forget generic media keys like play/pause, next, etc.

They work with a lot of apps, thats how I control Spotify via a AutoIT GUI.


#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIButton.au3>
#include <WindowsConstants.au3>
#pragma compile(Icon, E:\Users\it022565\Desktop\Desktop\System Tools\iconsext\icons\imageres_34.ico)

FileInstall("VolDown.jpg", @TempDir & "\VolDown.jpg", 1)
FileInstall("Mute.jpg", @TempDir & "\Mute.jpg", 1)
FileInstall("VolUp.jpg", @TempDir & "\VolUp.jpg", 1)
FileInstall("Back.jpg", @TempDir & "\Back.jpg", 1)
FileInstall("Forward.jpg", @TempDir & "\Forward.jpg", 1)
FileInstall("Play.jpg", @TempDir & "\Play.jpg", 1)
FileInstall("Pause.jpg", @TempDir & "\Pause.jpg", 1)
FileInstall("Spotify.jpg", @TempDir & "\Spotify.jpg", 1)

AdLibRegister("KeepAlive", 60000)

#Region ### START Koda GUI section ### Form=C:\Users\it022565\Desktop\Media GUI\Form1.kxf
$Form1 = GUICreate("Patrick's Tablet Audio GUI", 621, 545, 192, 124)
$Button1 = GUICtrlCreatePic(@TempDir & "\VolDown.jpg", 56, 416, 90, 90)
$Button2 = GUICtrlCreatePic(@TempDir & "\Mute.jpg", 269, 418, 90, 90)
$Button3 = GUICtrlCreatePic(@TempDir & "\VolUp.jpg", 493, 418, 90, 90)
$Button4 = GUICtrlCreatePic(@TempDir & "\Back.jpg", 60, 223, 90, 90)
$Button5 = GUICtrlCreatePic(@TempDir & "\Play.jpg", 225, 169, 180, 180)
$Button6 = GUICtrlCreatePic(@TempDir & "\Forward.jpg", 491, 222, 90, 90)
$Button7 = GUICtrlCreatePic(@TempDir & "\Spotify.jpg", 260, 20, 110, 110)
$Label1 = GUICtrlCreateLabel("Spotify Now Playing Export Tool", 36, 140, 457, 24)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
#EndRegion ### END Koda GUI section ###

GUICtrlSetImage($Button5, @TempDir & "\Pause.jpg")
Global $vToggle = 1
Global $sWindow
Global $sWindow2

While 1
    If $sWindow <> $sWindow2 Then
        $sWindow = WinGetTitle("[CLASS:SpotifyMainWindow]", "")
        GUICtrlSetData($Label1, $sWindow)
        If StringRegExp($sWindow, "(?i)spotify") Then
            GUICtrlSetImage($Button5, @TempDir & "\Play.jpg")
            GUICtrlSetImage($Button5, @TempDir & "\Pause.jpg")
     $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $Button1
            Send("{VOLUME_DOWN 5}")
        Case $Button2
        Case $Button3
            Send("{VOLUME_UP 5}")
        Case $Button4
        Case $Button5
            ;$vToggle +=1
            ;If MOD($vToggle, 2) Then
            ;    GUICtrlSetImage($Button5, @TempDir & "\Pause.jpg")
            ;    GUICtrlSetImage($Button5, @TempDir & "\Play.jpg")
        Case $Button6
        Case $Button7
            If ProcessExists("Spotify.exe") Then
                ShellExecute(@UserProfileDir & "\AppData\Roaming\Spotify\Spotify.exe")
    $sWindow2 = WinGetTitle("[CLASS:SpotifyMainWindow]", "")

Func KeepAlive()
    $aCurrentPos = MouseGetPos()
    MouseMove($aCurrentPos[0]+1, $aCurrentPos[1])
    MouseMove($aCurrentPos[0]-1, $aCurrentPos[1])


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

  • Similar Content

    • marcoauto
      By marcoauto
      I Have a GUI with 2 VLC instance inside. I use VLC.au3 for receive the rtp streams
      I can watch the videos and listen the audio streams.
      Is there a way to read each stream audio volume value? I would like to show near the video stream the audiometers
      I saw some scripts to show audio meters, but only with mp3 or wav files
      This is my script:
      #include <GDIPlus.au3> #include "VLC.au3" Global $vlc128, $vlc129 Global $video_path128 = "128.m3u8" Global $video_path129 = "129.m3u8" _VLCErrorHandlerRegister() $g_hGUI = GUICreate("VLC", 200, 298, 192, 124) GUISetState() Global $Graphic = _GDIPlus_GraphicsCreateFromHWND($g_hGUI) $vlc128 = _GUICtrlVLC_Create(10,10,180,144) $vlc129 = _GUICtrlVLC_Create(10,154,180,144) _GUICtrlVLC_Clear($vlc128) _GUICtrlVLC_Play($vlc128, _GUICtrlVLC_Add($vlc128, $video_path128)) _GUICtrlVLC_SetVolume($vlc128,50) ;set the vlc volume to zero _GUICtrlVLC_Clear($vlc129) _GUICtrlVLC_Play($vlc129, _GUICtrlVLC_Add($vlc129, $video_path129)) _GUICtrlVLC_SetVolume($vlc129,100) ;set the vlc volume to max Do Until False * Not Sleep(100000) ;do nothing, just sleep 128.m3u8 file:
      #EXTINF:321,Example Artist - Example title
      and 129.m3u8 file:
      #EXTINF:321,Example Artist - Example title
    • vvb
      By vvb
      Hi All,

      I am trying to automate the installation and configuration of the latest version of VLC, V2.0.2.

      The automation of the GUI installation has no issues. However, when the script starts VLC for the first time, it gets presented a Privacy and Network Access Policy QWidget which has two QCheckBox and a non-standard button. I want to uncheck the QCheckBoxes and then click on the non-standard button but non of the standard commands work. In fact, the AutoIt Window Info is only able to pick up the widget title and nothing else.

      I can only get around it by sending: tab + space + tab + space + tab + space to perform the unchecking and clicking.

      Anyone know another way of doing this?


      Edit: Admins can delete this. Googling autoit+qcheckbox returned no results but autoit+qwidget did.

      Edit: Solved by exporting an existing config file and then after installation, copied the pre-canned config file over

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.