Jump to content

Recommended Posts

Posted (edited)

Hey,

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]")
ControlSend("","",$VLC,"{SPACE}")

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

Ideas?

Thanks

(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
    Sleep(100)
WEnd

Func Pause()
    ControlSend("","",$VLC,"{SPACE}")
EndFunc

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()
    ControlSend("","",$VLC,"^v")
EndFunc

 

Edited by Seminko
Posted (edited)

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
Spoiler

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

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

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

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

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.

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

Au3Record.exe

Posted

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")
GUISetState(@SW_SHOW)
#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")
        Else
            GUICtrlSetImage($Button5, @TempDir & "\Pause.jpg")
        EndIf
    EndIF
     $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            Send("{VOLUME_DOWN 5}")
        Case $Button2
            Send("{VOLUME_MUTE}")
        Case $Button3
            Send("{VOLUME_UP 5}")
        Case $Button4
            Send("{MEDIA_PREV}")
        Case $Button5
            Send("{MEDIA_PLAY_PAUSE}")
            ;$vToggle +=1
            ;If MOD($vToggle, 2) Then
            ;    GUICtrlSetImage($Button5, @TempDir & "\Pause.jpg")
            ;Else
            ;    GUICtrlSetImage($Button5, @TempDir & "\Play.jpg")
            ;EndIf
        Case $Button6
            Send("{MEDIA_NEXT}")
        Case $Button7
            If ProcessExists("Spotify.exe") Then
                ProcessClose("Spotify.exe")
            Else
                ShellExecute(@UserProfileDir & "\AppData\Roaming\Spotify\Spotify.exe")
            EndIf
    EndSwitch
    Sleep(10)
    $sWindow2 = WinGetTitle("[CLASS:SpotifyMainWindow]", "")
WEnd

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

 

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...