Media Player Control by Script RRS feed

  • Question

  • Hello Fellow devs,

    My problem is his. I have a program which is capable of opening a file when a particular hand gesture is made. I however would like to control my media player using said hand gestures. Either iTunes or Windows Media Player is fine. Basically I want to create a script or executable which upon opening will play/pause the current song. And another script to go next song, previous song. Is there any easy way to control Windows Media Player from a script or a VB program?

    Thank you very much.

    Saturday, August 24, 2013 5:18 AM


  • You just need to search to find programs in VB that use Windows Media Player. There's numerous programs with a variety of capabilities. And the Windows Media Player control provides all of the functions that the actual Windows Media Player provides I believe. The problem is finding all of those capabilities and learning how to use them.



    Here's a very simple program which uses the Windows Media Player control dropped on the Form from the Visual Studio toolbox after having added the control to the toolbox using Visual Studio, Tools tab, Choose ToolBox Item, Com components, Windows Media Player and pressing O.K. to add it as a control to the ToolBox.

    This just adds some songs to a list and the Button runs WMP. And WMP plays all the songs in the list. Thats nothing compared to all of the control capabilities that WMP has available.

    I doubt you can use "script" for the WMP.

    Option Strict On
    Public Class Form1
        Dim Songs As New List(Of String)
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Songs.Add("C:\Users\John\Music\Miami Vice Theme.mp3")
            For Each Item In Songs
                Dim song As WMPLib.IWMPMedia = AxWindowsMediaPlayer1.newMedia(Item)
        End Sub
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        End Sub
    End Class

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    • Edited by Mr. Monkeyboy Saturday, August 24, 2013 8:19 AM 5555
    • Proposed as answer by Carl Cai Monday, August 26, 2013 1:54 AM
    • Marked as answer by Carl Cai Friday, August 30, 2013 1:12 AM
    Saturday, August 24, 2013 8:17 AM